Browse Source

remove redundant page

Daniel Sheffield 1 week ago
parent
commit
78265943c2
3 changed files with 3 additions and 31 deletions
  1. 0 1
      site/add_item.sql
  2. 0 27
      site/items_today.sql
  3. 3 3
      site/timesheet_day.sql

+ 0 - 1
site/add_item.sql

@@ -49,6 +49,5 @@ SELECT 'card' as component
 , '' AS title
 , 1 AS columns
 ;
-SELECT '/items_today.sql?level=2&_sqlpage_embed' AS embed;
 SELECT '/timesheet_day.sql?level=2&_sqlpage_embed' AS embed;
 SELECT '/timesheet_history.sql?level=2&_sqlpage_embed' AS embed;

+ 0 - 27
site/items_today.sql

@@ -1,27 +0,0 @@
-SET TIME ZONE 'Pacific/Auckland';
-SET ":title" = 'Timesheet Items';
-SELECT 'shell' AS component
-  , 'dark' AS theme
-  , '/clock-2.svg' AS favicon
-  , 'clock-2' AS icon
-  , :title AS title
-;
-
-SET ":level" = CASE $level WHEN '' THEN 1 ELSE CAST($level AS INT) END;
-SELECT 'title' AS component
-  , :title AS contents
-  , COALESCE(CAST(:level AS INT), 1) AS level
-;
-SET ":ago" = CASE $ago WHEN '' THEN NULL ELSE $ago END;
-SELECT 'table' AS component
-  , TRUE AS striped_rows
-;
-SELECT id
-, project_id
-, description
-, duration
-, CAST(start AS TIME)
-, CAST("end" AS TIME)
-FROM today
-ORDER BY id DESC
-;

+ 3 - 3
site/timesheet_day.sql

@@ -28,9 +28,9 @@ SELECT id
 ,   project_id
 ,   description
 ,   COALESCE(duration, "end" - start)::text AS duration
-,   (COALESCE(start, "end" - duration) AT TIME ZONE 'UTC'::text) AS start
-,   (COALESCE("end", start + duration) AT TIME ZONE 'UTC'::text) AS "end"
+,   CAST(COALESCE(start, "end" - duration) AT TIME ZONE 'UTC' AS TIME) AS start
+,   CAST(COALESCE("end", start + duration) AT TIME ZONE 'UTC' AS TIME) AS "end"
 FROM items
-WHERE (COALESCE("end", start + duration) AT TIME ZONE 'UTC'::text)::date = (CURRENT_DATE - CAST(:ago AS INTERVAL))::date
+WHERE CAST(COALESCE("end", start + duration) AT TIME ZONE 'UTC' AS DATE) = CAST(CURRENT_DATE - CAST(COALESCE(:ago, '0:00:00') AS INTERVAL) AS DATE)
 ORDER BY id DESC
 ;