Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Develop

See merge request tmllull/la-viciacion!41
  • Loading branch information
tmllull committed Nov 19, 2024
2 parents 9bb0517 + 38c28b6 commit 47e070f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
24 changes: 20 additions & 4 deletions api/app/crud/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,23 @@ def get_games(
models.TimeEntry.start.label("last_played_time"),
)
.join(models.Game, models.UserGame.game_id == models.Game.id)
.join(models.PlatformTag, models.UserGame.platform == models.PlatformTag.id)
.outerjoin(models.PlatformTag, models.UserGame.platform == models.PlatformTag.id)
.join(
models.TimeEntry,
models.TimeEntry.project_clockify_id == models.UserGame.game_id,
models.TimeEntry.project_clockify_id == models.Game.id,
)
.where(
models.UserGame.user_id == user_id,
models.UserGame.completed == completed,
extract("year", models.UserGame.started_date) == season,
models.UserGame.user_id == user_id, models.TimeEntry.user_id == user_id
)
.group_by(
models.UserGame.user_id,
models.UserGame.game_id,
models.Game.name,
models.UserGame.played_time,
models.TimeEntry.start,
)
.order_by(desc(models.TimeEntry.start))
.limit(limit)
Expand All @@ -587,14 +595,22 @@ def get_games(
models.TimeEntry.start.label("last_played_time"),
)
.join(models.Game, models.UserGame.game_id == models.Game.id)
.join(models.PlatformTag, models.UserGame.platform == models.PlatformTag.id)
.outerjoin(models.PlatformTag, models.UserGame.platform == models.PlatformTag.id)
.join(
models.TimeEntry,
models.TimeEntry.project_clockify_id == models.UserGame.game_id,
models.TimeEntry.project_clockify_id == models.Game.id,
)
.where(
models.UserGame.user_id == user_id,
extract("year", models.UserGame.started_date) == season,
models.UserGame.user_id == user_id, models.TimeEntry.user_id == user_id
)
.group_by(
models.UserGame.user_id,
models.UserGame.game_id,
models.Game.name,
models.UserGame.played_time,
models.TimeEntry.start,
)
.order_by(desc(models.TimeEntry.start))
.limit(limit)
Expand Down
1 change: 1 addition & 0 deletions api/app/routers/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def get_user_statistics(
else:
data = {"message": ranking_type + " is not a valid ranking"}
content["type"] = ranking_type
content["len_data"] = len(data)
content["data"] = data
response.append(content)
return response

0 comments on commit 47e070f

Please sign in to comment.