|
@@ -62,31 +62,33 @@ def reply_uncommented_reviews():
|
|
def send_email_bad_reviews():
|
|
def send_email_bad_reviews():
|
|
locations = Location.objects.all()
|
|
locations = Location.objects.all()
|
|
for location in locations:
|
|
for location in locations:
|
|
|
|
+ to = settings.ADMIN_MAINTEINER_EMAILS
|
|
reviews = get_bad_reviews(location.location_id, hours=1)
|
|
reviews = get_bad_reviews(location.location_id, hours=1)
|
|
total_reviews = reviews.count()
|
|
total_reviews = reviews.count()
|
|
if total_reviews > 0:
|
|
if total_reviews > 0:
|
|
- to = settings.ADMIN_MAINTEINER_EMAILS
|
|
|
|
# Add location mainteiner email if it has an email
|
|
# Add location mainteiner email if it has an email
|
|
to.append(location.recipient_email) if location.recipient_email else None
|
|
to.append(location.recipient_email) if location.recipient_email else None
|
|
|
|
|
|
- subject = f"A negative review has been post in {location.care_name}."
|
|
|
|
|
|
+ subject = f"A negative Google review has been post in {location.care_name}."
|
|
message = f'''
|
|
message = f'''
|
|
<p>Hi there, </p>
|
|
<p>Hi there, </p>
|
|
- <p>There '''
|
|
|
|
|
|
+ <p>'''
|
|
if total_reviews > 1:
|
|
if total_reviews > 1:
|
|
- tt = f'are {total_reviews} negative reviews has'
|
|
|
|
|
|
+ tt = f'{total_reviews} negative Google reviews have'
|
|
else:
|
|
else:
|
|
- tt = f'is a negative review has '
|
|
|
|
|
|
+ tt = f'A negative Google review has '
|
|
message += tt + f'been posted in {location.care_name}.</p>'
|
|
message += tt + f'been posted in {location.care_name}.</p>'
|
|
for r in reviews:
|
|
for r in reviews:
|
|
- # link = r.location.review_site_url + '?reviewId='+r.review_id
|
|
|
|
|
|
+ link = f'<p>Link: {r.location.review_site_url}</p>'
|
|
name = f'<p><b>Reviewer Name:</b> {r.reviewer_name}</p>'
|
|
name = f'<p><b>Reviewer Name:</b> {r.reviewer_name}</p>'
|
|
- rating = f'<p><b>Rating:</b> {str(r.star_rating)} star rating.</p>'
|
|
|
|
- comment = f'<p><b>Comment: </b>{r.comment}</p>'
|
|
|
|
- message += name + rating + comment
|
|
|
|
- message += '<p>Regards,</p><p>Byte Trek Team</p>'
|
|
|
|
|
|
+ rating = f'<p style="color: red"><b>Rating:</b> {str(r.star_rating)} star rating.</p>'
|
|
|
|
+ comment = f'<p><b>Comment: </b>{r.comment if r.comment else "No comment"}</p>'
|
|
|
|
+ message += name + rating + comment + link
|
|
|
|
+ message += '<p>Regards,</p><p>Byte Trek Ltd.</p>'
|
|
|
|
|
|
send_email(to_list=to, subject=subject, message=message)
|
|
send_email(to_list=to, subject=subject, message=message)
|
|
|
|
+ if location.recipient_email in to:
|
|
|
|
+ to.remove(location.recipient_email)
|
|
|
|
|
|
|
|
|
|
def background_task_6_hours_interval():
|
|
def background_task_6_hours_interval():
|