Bug time unexpected userid
This commit is contained in:
parent
4cba4bc5c8
commit
fafb6cb428
42
api/views.py
42
api/views.py
|
|
@ -472,7 +472,12 @@ def deleteNCFile(request, fid, secretkey):
|
|||
@api_view(['GET'], )
|
||||
def startWorkDay(request, uid, secretkey):
|
||||
if request.method == "GET" and secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN':
|
||||
user = User.objects.filter(username=uid).first()
|
||||
|
||||
username_new = uid.replace("REPLACEDATAELEMENTVER0000000001", "@")
|
||||
username_new = username_new.replace("POINTPOINTPOINTPOINTPOINTPOINT", ".")
|
||||
|
||||
user = User.objects.filter(username=username_new).first()
|
||||
|
||||
today = date.today()
|
||||
targettime = 0.0
|
||||
if(today.isoweekday() == 1):
|
||||
|
|
@ -597,7 +602,17 @@ def loadaccounttime(user):
|
|||
@api_view(['GET'], )
|
||||
def getTime(request, uid, secretkey):
|
||||
if request.method == "GET" and secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN':
|
||||
user = User.objects.filter(username=uid).first()
|
||||
|
||||
username_new = uid.replace("REPLACEDATAELEMENTVER0000000001", "@")
|
||||
username_new = username_new.replace("POINTPOINTPOINTPOINTPOINTPOINT", ".")
|
||||
|
||||
user = User.objects.filter(username=username_new).first()
|
||||
|
||||
usetime = True
|
||||
|
||||
if(user.usertime!= None and user.usertime.usetime == False):
|
||||
usetime = False
|
||||
|
||||
wd = Workday.objects.filter(user=user, agency=user.profile.agency, end=None, delflag = False)
|
||||
workdaydata_workday = 0
|
||||
workdaydata_starttime = 0
|
||||
|
|
@ -634,7 +649,7 @@ def getTime(request, uid, secretkey):
|
|||
breakstart = list(wdbreak)[0].start
|
||||
breaktimer = (now - breakstart).seconds * 1000
|
||||
|
||||
return JsonResponse({'actualtime' : loadaccounttime(user)[0], 'workdaydata_workday' : workdaydata_workday, 'workdaydata_starttime' : workdaydata_starttime, 'breakstatus' : breakstatus, 'breaktimer' : breaktimer, 'breaksum' : breaksum})
|
||||
return JsonResponse({'actualtime' : loadaccounttime(user)[0], 'workdaydata_workday' : workdaydata_workday, 'workdaydata_starttime' : workdaydata_starttime, 'breakstatus' : breakstatus, 'breaktimer' : breaktimer, 'breaksum' : breaksum, 'usetime' : usetime})
|
||||
|
||||
else:
|
||||
return ({"status" : "FALSE"})
|
||||
|
|
@ -645,7 +660,12 @@ def getTime(request, uid, secretkey):
|
|||
@api_view(['GET'], )
|
||||
def endWorkDay(request, uid, secretkey):
|
||||
if request.method == "GET" and secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN':
|
||||
user = User.objects.filter(username=uid).first()
|
||||
|
||||
username_new = uid.replace("REPLACEDATAELEMENTVER0000000001", "@")
|
||||
username_new = username_new.replace("POINTPOINTPOINTPOINTPOINTPOINT", ".")
|
||||
|
||||
user = User.objects.filter(username=username_new).first()
|
||||
|
||||
wd = list(Workday.objects.filter(user=user, agency=user.profile.agency, end=None, delflag = False))[0]
|
||||
# END ALL BREAKS
|
||||
for b in wd.breaks.all():
|
||||
|
|
@ -674,7 +694,12 @@ def endWorkDay(request, uid, secretkey):
|
|||
@api_view(['GET'], )
|
||||
def startBreak(request, uid, secretkey):
|
||||
if request.method == "GET" and secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN':
|
||||
user = User.objects.filter(username=uid).first()
|
||||
|
||||
username_new = uid.replace("REPLACEDATAELEMENTVER0000000001", "@")
|
||||
username_new = username_new.replace("POINTPOINTPOINTPOINTPOINTPOINT", ".")
|
||||
|
||||
user = User.objects.filter(username=username_new).first()
|
||||
|
||||
wd = list(Workday.objects.filter(user=user, agency=user.profile.agency, end=None, delflag = False))[0]
|
||||
newbreak = Breaks(workday=wd, user=user, agency=user.profile.agency, start=timezone.now())
|
||||
newbreak.save()
|
||||
|
|
@ -691,7 +716,12 @@ def startBreak(request, uid, secretkey):
|
|||
@api_view(['GET'], )
|
||||
def endBreak(request, uid, secretkey):
|
||||
if request.method == "GET" and secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN':
|
||||
user = User.objects.filter(username=uid).first()
|
||||
|
||||
username_new = uid.replace("REPLACEDATAELEMENTVER0000000001", "@")
|
||||
username_new = username_new.replace("POINTPOINTPOINTPOINTPOINTPOINT", ".")
|
||||
|
||||
user = User.objects.filter(username=username_new).first()
|
||||
|
||||
|
||||
wd = list(Workday.objects.filter(user=user, agency=user.profile.agency, end=None, delflag = False))[0]
|
||||
toendbreak = list(wd.breaks.filter(end=None))[0]
|
||||
|
|
|
|||
|
|
@ -243,31 +243,9 @@
|
|||
|
||||
</script>
|
||||
<!-- Topbar Navbar -->
|
||||
<ul class="navbar-nav ml-auto ">
|
||||
<!--<ul class="navbar-nav ml-auto ">-->
|
||||
<!-- TASK: Hier Cookie mit einbauen -->
|
||||
{% getIsUserStartTime request.user as starttime %}
|
||||
{% if request.user.usertime.usetime and starttime %}
|
||||
|
||||
<li class="nav-item dropdown no-arrow mx-1">
|
||||
<a class="nav-link dropdown-toggle" id="timemanagement_realtime" role="button" data-toggle="dropdown" aria-haspopup="true" onclick="javascript:toggleDropDown()">
|
||||
<i class="far fa-clock"></i>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-list dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="" id="timemanagement_clock" name="timemanagement_clock" aria-expanded="false" aria-role="static" style="display: none;">
|
||||
<h6 class="dropdown-header text-white">
|
||||
Zeiterfassung
|
||||
<span style="float: right"><button onclick="javascript:toggleDropDown()" class="btn btn-small" style="margin-top: -15px; margin-right: -20px;">x</button></span>
|
||||
</h6>
|
||||
<div>
|
||||
{% block timemanagement_content_realtime %}
|
||||
{% include "timemanagement/realtime_dropdown.html" %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<a class="dropdown-item text-center small text-gray-500" href="{% url 'tm-management' %}">Zur Zeiterfassung</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
<!-- ALERT_AREA -->
|
||||
|
|
@ -352,7 +330,7 @@
|
|||
</div>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
</nav>
|
||||
<!--</nav>-->
|
||||
|
||||
<!-- End of Topbar -->
|
||||
<!-- Begin Page Content -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue