<commit_before>package com.botconf.usecases
import android.content.Context
import com.botconf.android.interfaceadapters.persistence.sqlite.AppPersistenceDataSource
import com.botconf.entities.interfaces.ITalk
import com.botconf.entities.interfaces.IAppPersistenceDataSource
import com.botconf.entities.interfaces.IConference
import com.botconf.entities.interfaces.ISpeaker
import com.botconf.entities.interfaces.ITalkCard
import groovy.transform.CompileStatic

@CompileStatic
class LocalRepositoryUseCase {

    IAppPersistenceDataSource dataSource

    LocalRepositoryUseCase(Context ctx) {
        dataSource = new AppPersistenceDataSource(ctx)
    }

    int countTalkCardsFromLocalRepository() {

        dataSource.countTalks()
    }

    List<ITalkCard> fetchTalkCardsFromLocalRepository() {

        dataSource.findAllTalkCards()
    }

    List<ITalkCard> fetchFavouriteTalkCardsFromLocalRepository() {

        dataSource.findAllFavouriteTalkCards()
    }<commit_msg>Add use case to show only upcoming talks<commit_after>package com.botconf.usecases
import android.content.Context
import com.botconf.android.interfaceadapters.persistence.sqlite.AppPersistenceDataSource
import com.botconf.entities.interfaces.ITalk
import com.botconf.entities.interfaces.IAppPersistenceDataSource
import com.botconf.entities.interfaces.IConference
import com.botconf.entities.interfaces.ISpeaker
import com.botconf.entities.interfaces.ITalkCard
import groovy.time.TimeCategory
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode

@CompileStatic
class LocalRepositoryUseCase {

    IAppPersistenceDataSource dataSource

    List<ITalkCard> fetchUpcomingTalkCardsFromLocalRepository() {
        def aWeekAgoDate = aWeekAgo()
        dataSource.findAllTalkCards().findAll { aWeekAgoDate.before(it.start) }
    }

    @CompileStatic(TypeCheckingMode.SKIP)
    Date aWeekAgo() {
        def currentDate = new Date()
        use( TimeCategory ) {
            currentDate = currentDate - 1.week
        }
        currentDate
    }

    LocalRepositoryUseCase(Context ctx) {
        dataSource = new AppPersistenceDataSource(ctx)
    }

    int countTalkCardsFromLocalRepository() {

        dataSource.countTalks()
    }

    List<ITalkCard> fetchTalkCardsFromLocalRepository() {

        dataSource.findAllTalkCards()
    }

    List<ITalkCard> fetchFavouriteTalkCardsFromLocalRepository() {

        dataSource.findAllFavouriteTalkCards()
    }
{'fraction_non_alphanumeric': 0.07282343368592352, 'fraction_numerical': 0.0004068348250610252, 'mean_word_length': 4.416299559471366, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5936480', 'n_tokens_mistral': 740, 'n_tokens_neox': 704, 'n_words': 105}