|
@@ -4,8 +4,9 @@ from rest_framework.response import Response
|
|
from django.views.generic import View
|
|
from django.views.generic import View
|
|
|
|
|
|
from gauth.models import Location
|
|
from gauth.models import Location
|
|
|
|
+from name_extractor.models import Staff
|
|
|
|
|
|
-from .utils import get_review_count_by_month, get_review_count_by_week
|
|
|
|
|
|
+from .utils import get_review_count_by_month, get_review_count_by_week, last_month_reviews
|
|
|
|
|
|
|
|
|
|
class ChartDataByMonth(APIView):
|
|
class ChartDataByMonth(APIView):
|
|
@@ -23,3 +24,15 @@ class AnalyticsData(View):
|
|
def get(self, request, *args, **kwargs):
|
|
def get(self, request, *args, **kwargs):
|
|
locations = Location.objects.all()
|
|
locations = Location.objects.all()
|
|
return render(request, 'charts.html', {'location_list': locations})
|
|
return render(request, 'charts.html', {'location_list': locations})
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def monthly_report(requests, location_id):
|
|
|
|
+ last_month_data = last_month_reviews(location_id=location_id)
|
|
|
|
+
|
|
|
|
+ staffs = Staff.objects.filter(location_id=location_id).exclude(name_mentioned=0).order_by('-total_units')
|
|
|
|
+ context = {
|
|
|
|
+
|
|
|
|
+ 'this_month': last_month_data,
|
|
|
|
+ 'staffs': staffs
|
|
|
|
+ }
|
|
|
|
+ return render(requests, 'last_month_report.html', context)
|