Fix recurring transactions query

This commit is contained in:
William Brawner 2021-12-06 21:41:44 -07:00
parent 82939020f7
commit 8969a7f2d2

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()} < ? AND ${Fields.FINISH.name.lowercase()} > ?", listOf(now, now))
conn.executeQuery("SELECT * FROM $tableName WHERE ${Fields.START.name.lowercase()} < ? AND (${Fields.FINISH.name.lowercase()} IS NULL OR ${Fields.FINISH.name.lowercase()} > ?)", listOf(now, now))
}
override suspend fun findAll(budgetId: String): List<RecurringTransaction> = dataSource.connection.use { conn ->