Skip to content
Snippets Groups Projects
Commit 74cdb03c authored by Nguyen12.Minh@live.uwe.ac.uk's avatar Nguyen12.Minh@live.uwe.ac.uk
Browse files

fix admin.py

parent f447c185
No related branches found
No related tags found
No related merge requests found
Pipeline #9150 failed
...@@ -213,17 +213,14 @@ def get_user_statistics( ...@@ -213,17 +213,14 @@ def get_user_statistics(
# Count users by creation date # Count users by creation date
user_counts = session.exec( user_counts = session.exec(
select( select(func.date(User.created_at).label("day"), func.count().label("count"))
func.strftime("%Y-%m-%d", User.created_at).label("day"),
func.count().label("count"),
)
.where(User.created_at >= start_date) .where(User.created_at >= start_date)
.group_by(func.strftime("%Y-%m-%d", User.created_at)) .group_by(func.date(User.created_at))
).all() ).all()
# Update counts # Update counts
for day_data in user_counts: for day_data in user_counts:
day_str = day_data[0] # Now it's already in the correct string format day_str = day_data[0].strftime("%Y-%m-%d")
users_by_day[day_str] = day_data[1] users_by_day[day_str] = day_data[1]
# Convert to list of dictionaries # Convert to list of dictionaries
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment