From d3b1442afcc65253e224de70080342e54474b4c0 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 21 Oct 2024 15:43:36 -0400 Subject: [PATCH] commit: 2024-10-21 15:43:36 --- build_new.sh | 2 ++ dump_new.pg.sql | 11 +++++++---- map.pg.sql | 29 +++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 build_new.sh create mode 100644 map.pg.sql diff --git a/build_new.sh b/build_new.sh new file mode 100644 index 0000000..c6f55ba --- /dev/null +++ b/build_new.sh @@ -0,0 +1,2 @@ + +$PG -t -A -f dump_new.pg.sql >> /mnt/c/Users/ptrowbridge/hc_notes/transcribe.md diff --git a/dump_new.pg.sql b/dump_new.pg.sql index de13b1a..9394a48 100644 --- a/dump_new.pg.sql +++ b/dump_new.pg.sql @@ -5,6 +5,7 @@ ext AS ( -- t.filename (t.mdate - ((EXTRACT(DOW FROM t.mdate) - 5 + 7) % 7) * INTERVAL '1 day')::date AS week_ending ,t.mdate + ,message->>'rep' rep ,message->>'text' markdown ,to_char(row_number() OVER (partition by (t.mdate - ((EXTRACT(DOW FROM t.mdate) - 5 + 7) % 7) * INTERVAL '1 day')::date),'FM000') seq FROM @@ -45,13 +46,14 @@ ext AS ( ,w.seq || '.' || e.seq || '.' || r.flag seq ,CASE r.flag WHEN 'A' THEN '## [[]]' - WHEN 'B' THEN e.markdown - WHEN 'C' THEN '' + WHEN 'B' THEN '' + WHEN 'C' THEN e.markdown + WHEN 'D' THEN '' END markdown -- ,r.flag FROM ext e - CROSS JOIN (VALUES ('A'),('B'),('C')) r (flag) + CROSS JOIN (VALUES ('A'),('B'),('C'),('D')) r (flag) INNER JOIN wk w ON w.week_ending = e.week_ending ) @@ -70,4 +72,5 @@ ext AS ( FROM wkh ) -SELECT * FROM stack order by seq limit 1000 +-- SELECT markdown FROM stack order by seq +select * from ext diff --git a/map.pg.sql b/map.pg.sql new file mode 100644 index 0000000..0d0e7f0 --- /dev/null +++ b/map.pg.sql @@ -0,0 +1,29 @@ +SELECT + t.filename + ,substring(message->>'text',1,50) + ,message +FROM + rlarp.thirtysec t +WHERE + --substring(message->>'text',1,100) ~ 'Tony Land' + message->>'rep' IS NULL +ORDER BY filename desc + + +SELECT + t.filename + ,substring(message->>'text',1,50) +FROM + rlarp.thirtysec t +WHERE + substring(message->>'text',1,100) ~ 'Maxwell' + AND message->>'rep' IS NULL +ORDER BY filename desc + +UPDATE + rlarp.thirtysec t +SET + message = message || '{"rep":"Colin Maxwell"}'::jsonb +WHERE + substring(message->>'text',1,50) ~ 'Maxwell' + AND message->>'rep' IS NULL