timekeeper

[Abandoned unfinished] CGI web application in C for time tracking. (My first, just a learning project)
Log | Files | Refs | README

commit b2af7f344f3c14d899cbfe838b954250518de217
parent 197643005dc96cc97bf085a8a26893d26c0cdb35
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sun, 31 Mar 2024 18:34:00 -0700

Only update null times in Stmt*Time statements

Diffstat:
Mstmt.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/stmt.c b/stmt.c @@ -92,24 +92,26 @@ 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 IS NOT NULL" + " WHERE userid IS ? AND end NOTNULL AND\n" + " start ISNULL" }, [StmtStartBreakTime] = { .stmt = "UPDATE times SET startbreak = ?\n" " WHERE userid IS ? AND entry IS\n" - " (SELECT (entry) FROM current_entries WHERE userid IS ?)" + " (SELECT (entry) FROM current_entries WHERE userid IS ?) AND\n" + " startbreak ISNULL" }, [StmtEndBreakTime] = { .stmt = "UPDATE times SET endbreak = ?\n" " WHERE userid IS ? AND entry IS\n" " (SELECT (entry) FROM current_entries WHERE userid IS ?) AND\n" - " startbreak NOTNULL" + " startbreak NOTNULL and endbreak ISNULL" }, [StmtEndTime] = { .stmt = "UPDATE times SET end = ?\n" " WHERE userid IS ? AND entry IS\n" " (SELECT (entry) FROM current_entries WHERE userid IS ?) AND\n" - " start NOTNULL" + " start NOTNULL AND end ISNULL" }, [StmtGetTimes] = { .stmt = "SELECT period, entry, start, startbreak, endbreak, end FROM times\n"