🐛 Fix toConfirm
continuous-integration/drone/push Build is passing Details

pull/12/head
Arthur VALIN 1 year ago
parent ab2c861902
commit 0dd1017e81

@ -33,11 +33,13 @@ class MockBetDataSource(mockData: MockDataSource.MockData) : BetDataSource {
override fun updateBetStatuses(date: ZonedDateTime) { override fun updateBetStatuses(date: ZonedDateTime) {
bets.forEachIndexed { idx, bet -> bets.forEachIndexed { idx, bet ->
if (date >= bet.endRegistration) { if (bet.status != CANCELLED && bet.status != FINISHED) {
if (date >= bet.endBet) { if (date >= bet.endRegistration) {
bets[idx] = bet.copy(status = WAITING) if (date >= bet.endBet) {
} else { bets[idx] = bet.copy(status = WAITING)
bets[idx] = bet.copy(status = CLOSING) } else {
bets[idx] = bet.copy(status = CLOSING)
}
} }
} }
} }

@ -204,7 +204,9 @@ class PostgresBetDataSource(private val database: Database) : BetDataSource {
set(BetsEntity.status, BetStatus.WAITING) set(BetsEntity.status, BetStatus.WAITING)
where { where {
(date.toInstant() greaterEq BetsEntity.endRegistration) and (date.toInstant() greaterEq BetsEntity.endRegistration) and
(date.toInstant() less BetsEntity.endBet) (date.toInstant() less BetsEntity.endBet) and
(BetsEntity.status notEq BetStatus.FINISHED) and
(BetsEntity.status notEq BetStatus.CANCELLED)
} }
} }

@ -92,8 +92,8 @@ fun Application.BetRouter() {
BetDetail( BetDetail(
it, it,
getBetAnswerDetail(it, participations), getBetAnswerDetail(it, participations),
participations.toList(), participations,
participationDataSource.getParticipationFromUserId(user.username, it.id).lastOrNull() participations.find { it.username == user.username }
) )
} }
call.respond(HttpStatusCode.Accepted, response) call.respond(HttpStatusCode.Accepted, response)

Loading…
Cancel
Save