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