2 Commits 4570b10da7 ... b0c8c6d8b0

Author SHA1 Message Date
  Daniel Sheffield b0c8c6d8b0 add examples 6 months ago
  Daniel Sheffield 47b010f993 Added mapping for online Woolworths orders and TOFS orders 6 months ago
2 changed files with 16 additions and 0 deletions
  1. 14 0
      example.sql
  2. 2 0
      reconcile.py

+ 14 - 0
example.sql

@@ -1,6 +1,20 @@
 -- Insert a tag if it got missed
 --INSERT INTO tags_map (transaction_id, tag_id) VALUES(2247, 11);
+
+-- Check your filter is correct first!
 SELECT * FROM transactions t
 	LEFT JOIN tags_map ON (transaction_id = t.id)
 	LEFT JOIN tags tg ON (tag_id = tg.id)
 	WHERE transaction_id = 2247;
+
+
+-- Move from date to datej
+--UPDATE public.transactions
+--    -- Set the correct date on all rows that match the filter: Noon NZ time on 30 April 2024 (use exact time if known)
+--    SET  ts=('2024-04-30 12:00'::timestamp with time zone AT TIME ZONE 'UTC')
+--    -- Filter to the rows you want to alter: Noon NZ time on 15 April 2024 (use exact time if knwon)
+--    WHERE ts::date = ('2024-04-15 12:00'::timestamp with time zone AT TIME ZONE 'UTC')::date;
+
+-- Check your filter is correct first!
+SELECT *, sum(price) OVER () FROM  public.transactions
+WHERE ts::date = ('2024-04-15 12:00'::timestamp with time zone AT TIME ZONE 'UTC')::date and store_id = 8;

+ 2 - 0
reconcile.py

@@ -59,6 +59,8 @@ STORE_CODES = {
     'Fruit King' : 'FK',
     'Fresh Choice': 'FC',
     'FC12-3189-0013895-00': 'DV',
+    'ORGANIC FOOD SH' : 'TOFS',
+    'WWNZ' : 'CD',
 }
 
 user = os.getenv('USER')