commit ca77dfc3d7bc2c82bbebb6d8be0b76ce5ea35894
parent 67cd991b0865b05f9e33e5172d1d6dc5b07164de
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Wed, 3 Apr 2024 19:02:39 -0700
Fix start time statement
It uses a select statement to find the largest entry with the given
userid that is not ended and increments it by 1 to use as the new
row's entry (or not, if it already exists in the case of a row in
which end is not set). The criteria "start ISNULL" broke this
entirely.
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/stmt.c b/stmt.c
@@ -85,8 +85,7 @@ struct sqlbox_pstmt pstmts[] = {
[StmtStartTime] = { .stmt =
"INSERT OR IGNORE INTO times (userid, entry, start)\n"
" SELECT ?, IFNULL(max(entry) + 1, 1), ? FROM times\n"
- " WHERE userid IS ? AND end NOTNULL AND\n"
- " start ISNULL"
+ " WHERE userid IS ? AND end NOTNULL"
},
[StmtStartBreakTime] = { .stmt =
"UPDATE times SET startbreak = ?\n"