@@ -25,7 +25,7 @@ class QueryParts(TypedDict):
2525class DroppedFields (TypedDict ):
2626 selected_columns : list [str ]
2727 equations : list [dict [str , list [str ]]]
28- orderby : list [dict [str , str ]]
28+ orderby : list [dict [str , str | list [ str ] ]]
2929
3030
3131COLUMNS_TO_DROP = (
@@ -357,14 +357,14 @@ def translate_orderbys(orderbys, equations, dropped_equations, new_equations):
357357
358358 # checks if equation index is out of bounds
359359 if len (equations ) < equation_index + 1 :
360- dropped_orderby_reason = "equation at this index doesn't exist "
360+ dropped_orderby_reason = "equation issue "
361361
362362 # if there are equations
363363 elif len (equations ) > 0 :
364364 selected_equation = equations [equation_index ]
365365 # if equation was dropped, drop the orderby too
366366 if selected_equation in dropped_equations :
367- dropped_orderby_reason = "equation was dropped"
367+ dropped_orderby_reason = "dropped"
368368 decoded_orderby = (
369369 selected_equation if not is_negated else f"-{ selected_equation } "
370370 )
@@ -376,12 +376,12 @@ def translate_orderbys(orderbys, equations, dropped_equations, new_equations):
376376 new_equation_index = new_equations .index (translated_equation )
377377 translated_orderby = [f"equation[{ new_equation_index } ]" ]
378378 except (IndexError , ValueError ):
379- dropped_orderby_reason = "equation was dropped"
379+ dropped_orderby_reason = "dropped"
380380 decoded_orderby = (
381381 selected_equation if not is_negated else f"-{ selected_equation } "
382382 )
383383 else :
384- dropped_orderby_reason = "no equations in this query "
384+ dropped_orderby_reason = "no equations"
385385 decoded_orderby = orderby
386386
387387 # if orderby is an equation
@@ -390,17 +390,15 @@ def translate_orderbys(orderbys, equations, dropped_equations, new_equations):
390390 [orderby_without_neg ]
391391 )
392392 if len (dropped_orderby_equation ) > 0 :
393- dropped_orderby_reason = "fields were dropped: " + ", " .join (
394- dropped_orderby_equation [0 ]["reason" ]
395- )
393+ dropped_orderby_reason = dropped_orderby_equation [0 ]["reason" ]
396394
397395 # if orderby is a field/function
398396 else :
399397 translated_orderby , dropped_orderby = translate_columns (
400398 [orderby_without_neg ], need_equation = True
401399 )
402400 if len (dropped_orderby ) > 0 :
403- dropped_orderby_reason = "fields were dropped: " + ", " . join ( dropped_orderby )
401+ dropped_orderby_reason = dropped_orderby
404402
405403 # add translated orderby to the list and record dropped orderbys
406404 if dropped_orderby_reason is None :
0 commit comments