|
@@ -28,6 +28,7 @@ from queue import Queue, Empty
|
|
|
|
|
|
from ..data.filter import(
|
|
|
get_filter,
|
|
|
+ get_query_param,
|
|
|
)
|
|
|
|
|
|
from ..data.util import(
|
|
@@ -80,12 +81,6 @@ ORDER BY "Product", "Category", "Group"
|
|
|
])
|
|
|
|
|
|
|
|
|
-def get_query_param(include, exclude):
|
|
|
- return '!'.join([
|
|
|
- '|'.join(sorted(include)),
|
|
|
- *([ '|'.join(sorted(exclude)) ] if exclude else [ ]),
|
|
|
- ])
|
|
|
-
|
|
|
def normalize_query(query: FormsDict, allow: Iterable[str] = None) -> str:
|
|
|
param = get_filter(query, allow=allow)
|
|
|
return urlencode([
|
|
@@ -105,6 +100,9 @@ LOCK = Lock()
|
|
|
def trend():
|
|
|
_, _, path, *_ = request.urlparts
|
|
|
normalized = normalize_query(request.query, allow=PARAMS)
|
|
|
+ if normalized in CACHE:
|
|
|
+ if request.params.get('reload') == 'true':
|
|
|
+ del CACHE[normalized]
|
|
|
|
|
|
if request.query_string != normalized:
|
|
|
return redirect(f'{path}?{normalized}')
|