diff --git a/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt b/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt index 8a8f1dd..d50d235 100644 --- a/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt +++ b/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt @@ -143,11 +143,11 @@ class MockBetDataSource(private val mockData: MockDataSource.MockData) : BetData } } - override fun getWonNotifications(username: String): List { + override fun getWonNotifications(userid: String): List { return bets.map { bet -> val notification = resultNotifications.find { it.first == bet.id } ?: return@map null val result = results.find { it.betId == bet.id } ?: return@map null - val participation = participations.find { it.username == username && it.betId == bet.id } + val participation = participations.find { it.userId == userid && it.betId == bet.id } ?: return@map null if (participation.answer == result.result) { diff --git a/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt b/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt index 23f9bba..30854d4 100644 --- a/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt +++ b/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt @@ -117,7 +117,7 @@ class PostgresBetDataSource(private val database: Database) : BetDataSource { database.participations .filter { - (it.id eq userid) and + (it.userid eq userid) and (it.betId eq notif.betId) } .mapNotNull { participation ->