send emails while errors
This commit is contained in:
parent
a72e1f67d2
commit
e74fc9d626
@ -2,10 +2,11 @@ import uuid
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from datetime import datetime, timezone
|
||||
from billard import utils, tasks
|
||||
from billard import utils
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from django.core.mail import mail_admins
|
||||
from celery import shared_task
|
||||
|
||||
|
||||
@ -111,8 +112,9 @@ def process_location_data():
|
||||
cli = Client.objects.filter(uuid=ld.client_id, desks__desk_no=ld.desk_no)
|
||||
if cli.count() < 1:
|
||||
ld.processed = True
|
||||
ld.error_msg = 'No location object found. Stopp processing!'
|
||||
ld.error_msg = 'No location object found. Stopp processing! {}, {}'.format(ld.client_id, ld.desk_no)
|
||||
ld.save()
|
||||
mail_admins(subject=ld.error_msg, message=ld.error_msg)
|
||||
# TODO Send error eMail to Admin
|
||||
else:
|
||||
cli = cli[0]
|
||||
@ -122,6 +124,8 @@ def process_location_data():
|
||||
if ac.count() > 0 and ac[0].time_to is None:
|
||||
ac[0].time_to = datetime.now()
|
||||
ac[0].save()
|
||||
mail_admins(subject='Accounting passt nicht',
|
||||
message='Vorheriges Accounting nicht abgeschlossen: Accounting_id {}'.format(ac[0].id))
|
||||
# TODO Send error eMail to Admin
|
||||
acc = Accounting(
|
||||
desk=desk,
|
||||
|
Loading…
Reference in New Issue
Block a user