diff options
author | T <t@tjp.lol> | 2025-08-05 11:37:02 -0600 |
---|---|---|
committer | T <t@tjp.lol> | 2025-08-05 11:37:08 -0600 |
commit | 665bd389a0a1c8adadcaa1122e846cc81f5ead31 (patch) | |
tree | f34f9ec77891308c600c680683f60951599429c3 /internal/database | |
parent | dc895cec9d8a84af89ce2501db234dff33c757e2 (diff) |
WIP TUI
Diffstat (limited to 'internal/database')
-rw-r--r-- | internal/database/queries.sql | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/database/queries.sql b/internal/database/queries.sql index 3a644b8..c68cdad 100644 --- a/internal/database/queries.sql +++ b/internal/database/queries.sql @@ -284,3 +284,32 @@ where p.id = @project_id and te.start_time <= @end_time and te.end_time is not null order by te.start_time; + +-- name: GetTodaySummary :one +select + cast(sum( + case + when te.end_time is null then + (julianday('now', 'utc') - julianday(te.start_time)) * 24 * 60 * 60 + else + (julianday(te.end_time) - julianday(te.start_time)) * 24 * 60 * 60 + end + ) as integer) as total_seconds +from time_entry te +where date(te.start_time) = date('now'); + +-- name: GetRecentTimeEntries :many +select * from time_entry +order by start_time desc +limit @limit_count; + +-- name: UpdateActiveTimerDescription :exec +update time_entry +set description = @description +where id = ( + select id + from time_entry + where end_time is null + order by start_time desc + limit 1 +); |