|
@@ -6,6 +6,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
|
|
from gauth.models import Location
|
|
|
from name_extractor.models import Staff
|
|
|
+from yelp.analytics import get_weekly_summary, get_staff_names
|
|
|
|
|
|
from .utils import (
|
|
|
get_review_count_by_month,
|
|
@@ -47,20 +48,19 @@ def monthly_report(requests, location_id):
|
|
|
|
|
|
|
|
|
def weekly_report(requests, location_id):
|
|
|
- g_reviews, g_ratings = weekly_reviews_summary(location_id=location_id)
|
|
|
-
|
|
|
- g_staff_names = [
|
|
|
- 'montgomery', 'sarah', 'sarrah', 'sarra',
|
|
|
- 'moss', 'katy', 'neal', 'linda', 'narinesingh', 'rajesh',
|
|
|
- 'neal-domanski', 'kimberly'
|
|
|
- ]
|
|
|
+ g_reviews, g_ratings, g_staff_names = weekly_reviews_summary(location_id=location_id)
|
|
|
+ y_reviews, y_ratings, y_staff_names = get_weekly_summary(location_id=location_id)
|
|
|
|
|
|
g_bad_reviews = g_reviews.filter(star_rating__lte=2)
|
|
|
+ y_bad_reviews = y_reviews.filter(rating__lte=2)
|
|
|
|
|
|
context = {
|
|
|
|
|
|
'google_ratings': g_ratings,
|
|
|
'google_staffs': g_staff_names,
|
|
|
- 'google_bad_reviews': g_bad_reviews
|
|
|
+ 'google_bad_reviews': g_bad_reviews,
|
|
|
+ 'yelp_ratings': y_ratings,
|
|
|
+ 'yelp_staffs': y_staff_names,
|
|
|
+ 'yelp_bad_reviews': y_bad_reviews
|
|
|
}
|
|
|
return render(requests, 'weekly_report.html', context)
|