|
@@ -156,10 +156,10 @@ def fetch_all_review(loc_id):
|
|
update_location_data(loc, average_rating, total_reviews, total_reviews_db)
|
|
update_location_data(loc, average_rating, total_reviews, total_reviews_db)
|
|
|
|
|
|
|
|
|
|
-def fetch_last_50_reviews(loc_id):
|
|
|
|
|
|
+def fetch_last_20_reviews(loc_id):
|
|
loc = Location.objects.get(pk=loc_id)
|
|
loc = Location.objects.get(pk=loc_id)
|
|
headers = get_auth_header()
|
|
headers = get_auth_header()
|
|
- url = get_review_list_url(loc_id)+'&pageSize=50'
|
|
|
|
|
|
+ url = get_review_list_url(loc_id)+'&pageSize=20'
|
|
res = get(url, headers=headers)
|
|
res = get(url, headers=headers)
|
|
if res.status_code == 401:
|
|
if res.status_code == 401:
|
|
return
|
|
return
|
|
@@ -177,7 +177,7 @@ def populate_reviews():
|
|
start = timezone.now()
|
|
start = timezone.now()
|
|
locations = get_all_location_ids()
|
|
locations = get_all_location_ids()
|
|
for loc_id in locations:
|
|
for loc_id in locations:
|
|
- fetch_last_50_reviews(loc_id)
|
|
|
|
|
|
+ fetch_last_20_reviews(loc_id)
|
|
end = timezone.now()
|
|
end = timezone.now()
|
|
elapsed = end - start
|
|
elapsed = end - start
|
|
print(f'Elapsed time: {elapsed.seconds//60} minutes and {elapsed.seconds % 60} secs.')
|
|
print(f'Elapsed time: {elapsed.seconds//60} minutes and {elapsed.seconds % 60} secs.')
|