Add card scan stats to API

This commit is contained in:
Tanner Collin 2020-06-04 02:28:20 +00:00
parent bdbf21f75a
commit 9b98ebf23a
3 changed files with 11 additions and 0 deletions

View File

@ -433,6 +433,11 @@ class SignupCountSerializer(serializers.ModelSerializer):
def get_month(self, obj): def get_month(self, obj):
return str(obj.month)[:7] return str(obj.month)[:7]
class SpaceActivitySerializer(serializers.ModelSerializer):
class Meta:
model = models.StatsSpaceActivity
fields = '__all__'
class HistoryChangeSerializer(serializers.ModelSerializer): class HistoryChangeSerializer(serializers.ModelSerializer):
class Meta: class Meta:

View File

@ -399,6 +399,11 @@ class SignupCountViewSet(Base, List):
# have to use method as slicing breaks makemigrations # have to use method as slicing breaks makemigrations
return models.StatsSignupCount.objects.order_by('-month')[:16][::-1] return models.StatsSignupCount.objects.order_by('-month')[:16][::-1]
class SpaceActivityViewSet(Base, List):
pagination_class = None
queryset = models.StatsSpaceActivity.objects.all()
serializer_class = serializers.SpaceActivitySerializer
class BackupView(views.APIView): class BackupView(views.APIView):
def get(self, request): def get(self, request):

View File

@ -22,6 +22,7 @@ router.register(r'training', views.TrainingViewSet, basename='training')
router.register(r'transactions', views.TransactionViewSet, basename='transaction') router.register(r'transactions', views.TransactionViewSet, basename='transaction')
router.register(r'charts/membercount', views.MemberCountViewSet, basename='membercount') router.register(r'charts/membercount', views.MemberCountViewSet, basename='membercount')
router.register(r'charts/signupcount', views.SignupCountViewSet, basename='signupcount') router.register(r'charts/signupcount', views.SignupCountViewSet, basename='signupcount')
router.register(r'charts/spaceactivity', views.SpaceActivityViewSet, basename='spaceactivity')
#router.register(r'me', views.FullMemberView, basename='fullmember') #router.register(r'me', views.FullMemberView, basename='fullmember')
#router.register(r'registration', views.RegistrationViewSet, basename='register') #router.register(r'registration', views.RegistrationViewSet, basename='register')