From 30c4cf199f5dfef575ffde3c5848dd3af821a4c5 Mon Sep 17 00:00:00 2001 From: "arthur.valin" Date: Wed, 7 Feb 2024 23:38:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20status=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt | 4 ++-- .../main/kotlin/allin/data/postgres/PostgresBetDataSource.kt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt b/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt index 1f64939..b6339ed 100644 --- a/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt +++ b/Sources/src/main/kotlin/allin/data/mock/MockBetDataSource.kt @@ -37,9 +37,9 @@ class MockBetDataSource(mockData: MockDataSource.MockData) : BetDataSource { if (bet.status != CANCELLED && bet.status != FINISHED) { if (date >= bet.endRegistration) { if (date >= bet.endBet) { - bets[idx] = bet.copy(status = WAITING) - } else { bets[idx] = bet.copy(status = CLOSING) + } else { + bets[idx] = bet.copy(status = WAITING) } } } diff --git a/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt b/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt index fbfba37..a16a74c 100644 --- a/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt +++ b/Sources/src/main/kotlin/allin/data/postgres/PostgresBetDataSource.kt @@ -214,7 +214,9 @@ class PostgresBetDataSource(private val database: Database) : BetDataSource { set(BetsEntity.status, BetStatus.CLOSING) where { (date.toInstant() greaterEq BetsEntity.endRegistration) and - (date.toInstant() greaterEq BetsEntity.endBet) + (date.toInstant() greaterEq BetsEntity.endBet) and + (BetsEntity.status notEq BetStatus.FINISHED) and + (BetsEntity.status notEq BetStatus.CANCELLED) } } }