Fix: only create recurring transactions that haven't already ended

This commit is contained in:
William Brawner 2021-11-27 21:52:36 -07:00
parent 1fe62dc410
commit 82939020f7

View file

@ -15,7 +15,7 @@ class JdbcRecurringTransactionRepository(dataSource: DataSource) :
override val conflictFields: Collection<String> = listOf(ID)
override suspend fun findAll(now: Instant): List<RecurringTransaction> = dataSource.connection.use { conn ->
conn.executeQuery("SELECT * FROM $tableName WHERE ${Fields.START.name.lowercase()} < ?", listOf(now))
conn.executeQuery("SELECT * FROM $tableName WHERE ${Fields.START.name.lowercase()} < ? AND ${Fields.FINISH.name.lowercase()} > ?", listOf(now, now))
}
override suspend fun findAll(budgetId: String): List<RecurringTransaction> = dataSource.connection.use { conn ->