소스 검색

fix unit being ignored

Pi 1 년 전
부모
커밋
7467a55fb2
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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}")