Filter event id in the DB query for active lives

This commit is contained in:
Maxime NATUREL 2022-05-30 10:06:04 +02:00
parent f707f177d9
commit 066c540eb7
2 changed files with 4 additions and 2 deletions

View File

@ -74,11 +74,13 @@ internal fun LiveLocationShareAggregatedSummaryEntity.Companion.findActiveLiveIn
realm: Realm,
roomId: String,
userId: String,
ignoredEventId: String
): List<LiveLocationShareAggregatedSummaryEntity> {
return LiveLocationShareAggregatedSummaryEntity
.whereRoomId(realm, roomId = roomId)
.equalTo(LiveLocationShareAggregatedSummaryEntityFields.USER_ID, userId)
.equalTo(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, true)
.notEqualTo(LiveLocationShareAggregatedSummaryEntityFields.EVENT_ID, ignoredEventId)
.findAll()
}

View File

@ -147,9 +147,9 @@ internal class LiveLocationAggregationProcessor @Inject constructor(
.findActiveLiveInRoomForUser(
realm = realm,
roomId = roomId,
userId = userId
userId = userId,
ignoredEventId = currentEventId
)
.filterNot { it.eventId == currentEventId }
.forEach { it.isActive = false }
}