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,12 +127,13 @@ 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 = ac[0]
if acc is None:
acc = Accounting( acc = Accounting(
desk=desk, desk=desk,
time_from=ld.tst, time_from=ld.tst,