fix: update ordering in deals by territory and salesperson queries

This commit is contained in:
Shariq Ansari 2025-08-18 17:57:10 +05:30
parent 8a62ff38af
commit f8aa6cab78

View File

@ -1008,7 +1008,7 @@ def get_deals_by_territory(from_date="", to_date="", user=""):
WHERE DATE(d.creation) BETWEEN %(from)s AND %(to)s
{deal_conds}
GROUP BY d.territory
ORDER BY value DESC
ORDER BY deals DESC, value DESC
""",
{"from": from_date, "to": to_date},
as_dict=True,
@ -1065,7 +1065,7 @@ def get_deals_by_salesperson(from_date="", to_date="", user=""):
WHERE DATE(d.creation) BETWEEN %(from)s AND %(to)s
{deal_conds}
GROUP BY d.deal_owner
ORDER BY value DESC
ORDER BY deals DESC, value DESC
""",
{"from": from_date, "to": to_date},
as_dict=True,