Bugfixing Cronjob ohne try
This commit is contained in:
parent
2851cc8807
commit
6d89d5f40d
|
|
@ -1415,6 +1415,7 @@ class landingPage(TemplateView):
|
|||
'''
|
||||
def absencecheck(user, daytocheck):
|
||||
returnstat = False
|
||||
print("ABSENCECHECK")
|
||||
absencedays = Absence.objects.filter(agency=user.profile.agency, user=user, confirm_status=0) & (Absence.objects.filter(agency=user.profile.agency, user=user, start=daytocheck) | (Absence.objects.filter(agency=user.profile.agency, user=user, start__lt=daytocheck) & Absence.objects.filter(agency=user.profile.agency, user=user, end__gt=daytocheck)) | Absence.objects.filter(agency=user.profile.agency, user=user, end=daytocheck))
|
||||
if(len(absencedays) > 0):
|
||||
returnstat = True
|
||||
|
|
@ -1432,7 +1433,7 @@ def cronactionsdaily(request, code):
|
|||
today = date.today()
|
||||
for user in allusers:
|
||||
# REST URLAUB BERECHNUNG
|
||||
try:
|
||||
#try:
|
||||
usertimedata = UserTime.objects.get(user=user)
|
||||
day_tocheck = usertimedata.loose_holidedate.split(".")[0]
|
||||
month_tocheck = usertimedata.loose_holidedate.split(".")[1]
|
||||
|
|
@ -1448,6 +1449,7 @@ def cronactionsdaily(request, code):
|
|||
day = "0" + str(day)
|
||||
else:
|
||||
day = day
|
||||
|
||||
# Restetag erreicht, Reste ins nächste Jahr übertragen
|
||||
if(str(day_tocheck) == str(day) and str(month_tocheck) == str(month)):
|
||||
sourceyear = today.year
|
||||
|
|
@ -1464,6 +1466,7 @@ def cronactionsdaily(request, code):
|
|||
|
||||
yesterday = date.today() - timedelta(days=1)
|
||||
weekday = yesterday.weekday()
|
||||
|
||||
workdays_yesterday = len(Workday.objects.filter(user=user, start__day=yesterday.day, start__month=yesterday.month, start__year=yesterday.year))
|
||||
|
||||
targettworktime = 0.0
|
||||
|
|
@ -1491,6 +1494,7 @@ def cronactionsdaily(request, code):
|
|||
|
||||
# Erinnerungsmails/Push bei Vertretung verschicken
|
||||
one_week_later = date.today() + timedelta(days=7)
|
||||
|
||||
repre_absence = Absence.objects.filter(representator=user, start=one_week_later, confirm_status=0)
|
||||
|
||||
for r in repre_absence:
|
||||
|
|
@ -1505,8 +1509,8 @@ def cronactionsdaily(request, code):
|
|||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | In einer Woche startet Ihre Vertretung für " + r.user.first_name + " " + r.user.last_name + "!"})
|
||||
|
||||
data.update({"status " + str(user.pk) : "ok"})
|
||||
except ObjectDoesNotExist:
|
||||
data.update({"status" + str(user.pk) : "no usertime found for " + user.get_full_name()})
|
||||
#except ObjectDoesNotExist:
|
||||
# data.update({"status" + str(user.pk) : "no usertime found for " + user.get_full_name()})
|
||||
else:
|
||||
print("API CODE FAILED")
|
||||
data.update({"status" : "failed"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue