mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-15 14:23:46 +00:00
add views for 2p 3p data
This commit is contained in:
1 parent
08e60d6838
commit
c9711ddd19
2 files changed
+3
-2
No files matched your search
+2
-1
@@ -1,5 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList
|
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'),
|
path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'),
|
||||||
@@ -7,4 +7,5 @@ urlpatterns = [
|
|||||||
path('api/playerdata/season/<str:season>/', PlayerDataBySeasonList.as_view(), name='playerdata_by_season'),
|
path('api/playerdata/season/<str:season>/', PlayerDataBySeasonList.as_view(), name='playerdata_by_season'),
|
||||||
path('api/playerdata/name/<str:name>/', PlayerDataByNameList.as_view(), name='playerdata_by_name'),
|
path('api/playerdata/name/<str:name>/', PlayerDataByNameList.as_view(), name='playerdata_by_name'),
|
||||||
path('api/playerdata/topscorers/season/<str:season>/', TopScorersbySeasonList.as_view(), name='top_scorers_by_season'),
|
path('api/playerdata/topscorers/season/<str:season>/', TopScorersbySeasonList.as_view(), name='top_scorers_by_season'),
|
||||||
|
path('api/three_two_point_trends/', ThreeTwoTopPointTrends.as_view(), name='three_two_point_trends'),
|
||||||
]
|
]
|
||||||
+1
-1
@@ -56,7 +56,7 @@ class TopScorersbySeasonList(generics.ListAPIView):
|
|||||||
|
|
||||||
# Fetch and calculate the average 3P made, 3P attemps, 2P made, 2P attempts for all players in each season.
|
# Fetch and calculate the average 3P made, 3P attemps, 2P made, 2P attempts for all players in each season.
|
||||||
# Will use APIview here instead of generics.ListAPIView to avoid having to create a serializer to generate the queryset. avg_three_made and avg_two_made are new data points at the time of creation when compared to the per_game model.
|
# Will use APIview here instead of generics.ListAPIView to avoid having to create a serializer to generate the queryset. avg_three_made and avg_two_made are new data points at the time of creation when compared to the per_game model.
|
||||||
class ThreeTopPointTrends(APIView):
|
class ThreeTwoTopPointTrends(APIView):
|
||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
seasons = PlayerData.objects.values_list(
|
seasons = PlayerData.objects.values_list(
|
||||||
'season', flat=True).distinct().order_by('season')
|
'season', flat=True).distinct().order_by('season')
|
||||||
|
|||||||
Reference in new issue
Block a user