Skip to content

Commit

Permalink
fix: leaderboard_data and top_cities sql query
Browse files Browse the repository at this point in the history
  • Loading branch information
anupamvs committed May 29, 2024
1 parent 3a7ec7c commit c970ed4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samaaja/www/stats/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_context(context):
"""
SELECT u.name, u.username, u.first_name, u.user_image, u.city as location, sum(e.hours_invested) as hours_invested, count(*) as total_actions from `tabUser` u
inner join `tabEvents` e on e.user = u.name where u.enabled = 1
and e.creation::date > current_date - interval %(day)s day
and DATE(e.creation) > current_date - interval %(day)s day
group by u.name order by count(*) desc limit %(page_size)s;
""",
values={
Expand All @@ -29,7 +29,7 @@ def get_context(context):
context.top_cities = frappe.db.sql(
"""
SELECT l.city, count(*) as count from `tabLocation` l inner join `tabEvents` e on e.location = l.name
where e.creation::date > current_date - interval %(day)s day
where DATE(e.creation) > current_date - interval %(day)s day
and l.city is NOT NULL
group by city order by count(*) desc limit %(page_length)s
""",
Expand Down

0 comments on commit c970ed4

Please sign in to comment.