|
@@ -8,7 +8,7 @@ from typing import Dict, Tuple
|
|
|
from bottle import template
|
|
|
from pandas import DataFrame
|
|
|
from itertools import chain
|
|
|
-from ..rest import ALL_UNITS
|
|
|
+from . import ALL_UNITS, BOOLEAN
|
|
|
|
|
|
def get_option_groups(
|
|
|
data: DataFrame, filter_data: Dict[str, Tuple[set, set]],
|
|
@@ -67,8 +67,8 @@ def get_option_groups(
|
|
|
}
|
|
|
|
|
|
|
|
|
-def get_form(action: str, method: str, filter_data, data: DataFrame):
|
|
|
- keys = sorted(filter(lambda x: x not in ('unit', 'tag'), filter_data), key=lambda x: {
|
|
|
+def get_form(action: str, method: str, filter_data: Dict[str, Tuple[set, set]], organic: bool, data: DataFrame):
|
|
|
+ keys = sorted(filter(lambda x: x not in ('unit', 'tag', 'organic'), filter_data), key=lambda x: {
|
|
|
'product': 0,
|
|
|
'category': 1,
|
|
|
'group': 2,
|
|
@@ -104,5 +104,6 @@ def get_form(action: str, method: str, filter_data, data: DataFrame):
|
|
|
map(lambda x: (True, x), filter_data['unit'][0]),
|
|
|
map(lambda x: (False, x), ALL_UNITS - filter_data['unit'][0])
|
|
|
)), key=lambda x: x["display"] if "display" in x else x["value"])
|
|
|
- }
|
|
|
+ },
|
|
|
+ organic=BOOLEAN[organic],
|
|
|
)
|