Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.example.util.simpletimetracker.core.repo.ResourceRepo
import com.example.util.simpletimetracker.core.viewData.CommentFilterTypeViewData
import com.example.util.simpletimetracker.domain.base.CommentFilterType
import com.example.util.simpletimetracker.domain.favourite.interactor.FavouriteCommentInteractor
import com.example.util.simpletimetracker.domain.favourite.interactor.RecordTypeToFavouriteCommentInteractor
import com.example.util.simpletimetracker.domain.prefs.interactor.PrefsInteractor
import com.example.util.simpletimetracker.domain.record.interactor.RecordInteractor
import com.example.util.simpletimetracker.domain.record.interactor.RunningRecordInteractor
Expand All @@ -24,6 +25,7 @@ class RecordCommentSearchViewDataInteractor @Inject constructor(
private val prefsInteractor: PrefsInteractor,
private val recordInteractor: RecordInteractor,
private val favouriteCommentInteractor: FavouriteCommentInteractor,
private val recordTypeToFavouriteCommentInteractor: RecordTypeToFavouriteCommentInteractor,
private val runningRecordInteractor: RunningRecordInteractor,
) {

Expand All @@ -35,7 +37,7 @@ class RecordCommentSearchViewDataInteractor @Inject constructor(
val result = mutableListOf<ViewHolderType>()

val similar = getSimilarData(comment)
val favourite = getFavouriteData()
val favourite = getFavouriteData(typeId)
val last = getLastCommentsData(typeId)

val filters = getFilters(
Expand Down Expand Up @@ -121,8 +123,11 @@ class RecordCommentSearchViewDataInteractor @Inject constructor(
}
}

private suspend fun getFavouriteData(): List<ViewHolderType> {
return favouriteCommentInteractor.getAll()
private suspend fun getFavouriteData(
typeId: Long,
): List<ViewHolderType> {
val comments = favouriteCommentInteractor.getAll()
return recordTypeToFavouriteCommentInteractor.filterFavourites(typeId, comments)
.map { RecordCommentViewData.Favourite(it.comment) }
}

Expand Down
Loading