modify ld processing

This commit is contained in:
Robert Einsle 2017-02-17 18:56:40 +01:00
parent 1ecb96f520
commit b46bd28ad6

View File

@ -127,16 +127,17 @@ def process_location_data():
desk = desk[0] desk = desk[0]
ac = desk.accounting_set.order_by('time_from').reverse() ac = desk.accounting_set.order_by('time_from').reverse()
if ld.on_off: if ld.on_off:
acc = None
if ac.count() > 0 and ac[0].time_to is None: if ac.count() > 0 and ac[0].time_to is None:
ac[0].time_to = ld.tst
ac[0].save()
mail_admins(subject='Accounting passt nicht', mail_admins(subject='Accounting passt nicht',
message='Vorheriges Accounting nicht abgeschlossen: Desk_id {}, Accounting_id {}' message='Vorheriges Accounting nicht abgeschlossen: Desk_id {}, Accounting_id {}'
.format(desk.id, ac[0].id)) .format(desk.id, ac[0].id))
acc = Accounting( acc = ac[0]
desk=desk, if acc is None:
time_from=ld.tst, acc = Accounting(
) desk=desk,
time_from=ld.tst,
)
acc.save() acc.save()
ld.delete() ld.delete()
else: else: