From 7eb095e17c7dceb3440455c2a35678fc9823204f Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 8 Sep 2020 21:59:42 -0700 Subject: [PATCH] Experiment: Use width*height instead of area column when searching. Will see if this has any adverse effects, or if it goes well I can remove the area and ratio columns. --- etiquette/searchhelpers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etiquette/searchhelpers.py b/etiquette/searchhelpers.py index 55410c2..a9b44b9 100644 --- a/etiquette/searchhelpers.py +++ b/etiquette/searchhelpers.py @@ -334,6 +334,12 @@ def normalize_orderby(orderby, warning_bag=None): if column == 'random': column = 'RANDOM()' + elif column == 'area': + column = 'width * height' + + elif column == 'ratio': + column = 'width / height' + if direction not in ('asc', 'desc'): message = constants.WARNING_ORDERBY_BADDIRECTION.format( column=column,