Skip to content

Commit

Permalink
revert: remove user stats view
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRomaa committed Mar 17, 2024
1 parent 48f16c5 commit 6bb7e50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/connections/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
path("top/positions/", views.TopPositionsView.as_view()),
path("sessions/<int:cid>/", views.ControllerSessionsView.as_view()),
path("daily/<int:year>/", views.DailyStatisticsView.as_view()),
path("daily/<int:year>/<int:cid>/", views.UserDailyStatisticsView.as_view()),
]
12 changes: 12 additions & 0 deletions apps/connections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,15 @@ def get(self, request, year):
connections = get_daily_statistics(year)
serializer = DailyConnectionsSerializer(connections, many=True)
return Response(serializer.data)


class UserDailyStatisticsView(APIView):
def get(self, request, year, cid):
"""
Get list of controlling hours for every
day of the given year for the given user.
"""
user = get_object_or_404(User, cid=cid)
connections = get_daily_statistics(year, user)
serializer = DailyConnectionsSerializer(connections, many=True)
return Response(serializer.data)

0 comments on commit 6bb7e50

Please sign in to comment.