diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index fc5ad04..e62d98e 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index 7882219..04d9fdd 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -341,6 +341,16 @@ def getactualworkingday(user): returnstat = list(wd)[0].start return returnstat +@register.simple_tag +def getIsUserStartTime(user): + + today = date.today() + starttime = False + if today >= user.usertime.usetime_start: + starttime = True + + return starttime + # Berechnet die gesamte Arbeitszeit im Monat und gibt diese zurück @register.simple_tag def loadmonthwork(nextmonth, user): @@ -356,8 +366,16 @@ def loadmonthwork(nextmonth, user): for ele in workdays.all(): if ele.end != None: - print(ele) finalsum += (ele.end - ele.start).seconds + + breaksum = 0 + for ele in workdays.all(): + for b in ele.breaks.all(): + if(b.end != None): + breaksum += (b.end - b.start).seconds + + finalsum -= breaksum + mon, sec = divmod(finalsum, 60) hr, mon = divmod(mon, 60) #return ("%d Stunden und %02d:%02d" % (hr, mon, sec)) diff --git a/users/templates/users/base.html b/users/templates/users/base.html index bed69c1..5c6162d 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -429,7 +429,8 @@