Explorar o código

fix unit being ignored

Pi hai 1 ano
pai
achega
7467a55fb2
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      app/rest/trend.py

+ 1 - 1
app/rest/trend.py

@@ -56,7 +56,7 @@ def trend_internal(conn: Connection[TupleRow], path: str, query: FormsDict):
                 k: get_query_param(*_filter[k])
                 for k in sorted(_filter) if k not in ('organic', 'unit') and _filter[k]
             }
-            unit = fields['unit'] = fields['unit'] or 'kg' if 'unit' in fields else 'kg'
+            unit = fields['unit'] = query.unit or 'kg'
             fields['organic'] = BOOLEAN.get(query.organic, None)
             if unit and unit not in ALL_UNITS:
                 yield abort(400, f"Unsupported unit {unit}")