|
@@ -24,12 +24,12 @@ TABLE_NAME = {
|
|
|
'yelp': 'yelp_yelpreview'
|
|
|
}
|
|
|
|
|
|
-now = timezone.now()
|
|
|
-beginning_of_month = now.replace(day=1, hour=0, minute=0, second=0)
|
|
|
-beginning_of_last_month = now - timezone.timedelta(days=now.day+31)
|
|
|
-
|
|
|
|
|
|
def get_google_review_report(location_id):
|
|
|
+ now = timezone.now()
|
|
|
+ beginning_of_month = now.replace(day=1, hour=0, minute=0, second=0)
|
|
|
+ beginning_of_last_month = now - timezone.timedelta(days=now.day + 31)
|
|
|
+
|
|
|
pos = Review.objects.filter(
|
|
|
location_id=location_id,
|
|
|
create_time__range=(beginning_of_month, now),
|
|
@@ -67,6 +67,10 @@ def get_google_review_report(location_id):
|
|
|
|
|
|
|
|
|
def get_facebook_report(location_id):
|
|
|
+ now = timezone.now()
|
|
|
+ beginning_of_month = now.replace(day=1, hour=0, minute=0, second=0)
|
|
|
+ beginning_of_last_month = now - timezone.timedelta(days=now.day + 31)
|
|
|
+
|
|
|
pos = FacebookReview.objects.filter(
|
|
|
page__location_id=location_id,
|
|
|
create_time__range=(beginning_of_month, now),
|
|
@@ -104,6 +108,10 @@ def get_facebook_report(location_id):
|
|
|
|
|
|
|
|
|
def get_yelp_review_report(location_id):
|
|
|
+ now = timezone.now()
|
|
|
+ beginning_of_month = now.replace(day=1, hour=0, minute=0, second=0)
|
|
|
+ beginning_of_last_month = now - timezone.timedelta(days=now.day + 31)
|
|
|
+
|
|
|
pos = YelpReview.objects.filter(
|
|
|
location__location_id=location_id,
|
|
|
date_posted__range=(beginning_of_month, now),
|
|
@@ -141,6 +149,9 @@ def get_yelp_review_report(location_id):
|
|
|
|
|
|
|
|
|
def get_this_month_analytics(location_id):
|
|
|
+ now = timezone.now()
|
|
|
+ beginning_of_month = now.replace(day=1, hour=0, minute=0, second=0)
|
|
|
+
|
|
|
google_qs = Review.objects.filter(
|
|
|
create_time__range=(beginning_of_month, now),
|
|
|
location_id=location_id
|