timekeeper

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

commit 5f45b62a48f73746bcfb1c8b5870e42e9391fa65
parent 72b90bc833f1803baee604d83726ce8b61df4adb
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sun, 17 Mar 2024 17:05:30 -0700

Add periods to database

Periods are just groups of time entries and are meant to be used
to show when the time you put in was payed.

Diffstat:
Mstmt.c | 9++++++++-
Mstmt.h | 1+
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/stmt.c b/stmt.c @@ -15,6 +15,7 @@ struct sqlbox_pstmt pstmts[] = { [StmtInit2] = { .stmt = "CREATE TABLE IF NOT EXISTS times (\n" " userid TEXT REFERENCES auth (hash),\n" + " period INTEGER,\n" " entry INTEGER DEFAULT 0 NOT NULL,\n" " start INTEGER,\n" " startbreak INTEGER,\n" @@ -69,6 +70,12 @@ struct sqlbox_pstmt pstmts[] = { }, [StmtGetTimes] = { .stmt = "SELECT start, startbreak, endbreak, end FROM times\n" - " WHERE userid IS ?" + " WHERE userid IS ? AND period ISNULL" + }, + [StmtBreakTime] = { .stmt = + "UPDATE times SET period =\n" + " (SELECT IFNULL(max(period) + 1, 0)\n" + " FROM times WHERE userid IS ?)\n" + " WHERE userid IS ? AND period ISNULL" } }; diff --git a/stmt.h b/stmt.h @@ -13,6 +13,7 @@ enum StmtID { StmtEndBreakTime, StmtEndTime, StmtGetTimes, + StmtBreakTime, StmtMax };