Browse Source

remove commented out code

Daniel Sheffield 2 years ago
parent
commit
4f280eb314
1 changed files with 0 additions and 49 deletions
  1. 0 49
      app/price_view.py

+ 0 - 49
app/price_view.py

@@ -61,30 +61,13 @@ def get_historic_prices_statement(sort, product, unit, organic=None, limit='90 d
 )""")
     select = OrderedDict([
         ('id', Identifier('transactions','id')),
-        #('ts', SQL('{identifier}::date').format(
-        #    identifier=Identifier('ts'),
-        #)),
         ('%d/%m/%y %_I%P', SQL("""(transactions.ts AT TIME ZONE 'UTC')::timestamp without time zone""")),
-        #('store', Identifier('stores', 'name')),
         ('code', Identifier('stores', 'code')),
-        #('description', Identifier('transactions','description')),
-        #('volume', Identifier('quantity')),
-        #('unit', Identifier('units', 'name')),
-        #('price', Identifier('price')),
         ('$/unit', SQL("""TRUNC(price / (quantity * factor), 4)""")),
         ('avg', SQL(f"""TRUNC(sum(price) OVER {partition} / sum(quantity * factor) OVER {partition}, 4)""")),
         ('min', SQL(f"""TRUNC(min(price / (quantity * factor)) OVER {partition}, 4)""")),
         ('max', SQL(f"""TRUNC(max(price / (quantity * factor)) OVER {partition}, 4)""")),
-        #('total', SQL("""sum(transactions.price) OVER (PARTITION BY transactions.ts::date ORDER BY transactions.id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)""")),
-        #('group', Identifier('groups','name')),
-        #('category', Identifier('categories','name')),
-        #('product', Identifier('products','name')),
         ('organic', Identifier('organic')),
-        
-        #('price_sum', SQL(f"""sum(price) OVER {partition}""")),
-        #('quantity_sum', SQL(f"""sum(quantity) OVER {partition}""")),
-        #('price_min', SQL(f"""min(price/quantity) OVER {partition}""")),
-        #('price_max', SQL(f"""max(price/quantity) OVER {partition}""")),
     ])
     statement = SQL('\n').join([
         _with,
@@ -142,35 +125,3 @@ def get_historic_prices_statement(sort, product, unit, organic=None, limit='90 d
         ),
     ])
     return statement
-    # cols = ('product', 'unit', 'organic', 'store', '$/unit',)
-    # aggs = {
-        # 'avg': SQL("""TRUNC(price_sum/quantity_sum, 4)"""),
-        # 'min': SQL("""TRUNC(price_min, 4)"""),
-        # 'max': SQL("""TRUNC(price_max, 4)"""),
-        # #'$/unit': SQL("""sum({price})/sum({quantity})""").format(
-        # #    price=Identifier("$/unit"),
-        # #    quantity=Identifier("quantity"),
-        # #)
-    # }
-    # groups = ( 'price_sum', 'quantity_sum', 'price_min', 'price_max')
-    # ret = SQL('\n').join([
-        # SQL('').join([
-            # SQL("SELECT"
-                # "\n  "),
-            # SQL(','
-                # "\n  ").join([Identifier(f'{k}') for k in groups ])
-            # ])
-        # SQL('').join([
-            # SQL("SELECT"
-                # "\n  "),
-            # SQL(','
-                # "\n  ").join([Identifier(f'{k}') for k in select ])
-            # ])
-        # SQL('ORDER BY {_id} DESC').format(_id=Identifier('transactions','id')),
-        # ])
-    #SELECT product, organic, store, unit, TRUNC("$/unit",2) AS "$/unit", TRUNC(price_sum/quantity_sum, 2) AS "avg", TRUNC(price_min,2) AS "min", TRUNC(price_max,2) AS "max", date 
-#FROM  (
-#sub
-#) AS subq
-#WHERE product = 'Apples'
-#GROUP BY organic, product, unit, "$/unit", price_sum, quantity_sum, price_min, price_max, date, store ;