Arbeitstage Historymodell dazu

This commit is contained in:
holger.trampe 2021-01-07 17:12:06 +01:00
parent 080b328165
commit 2851cc8807
6 changed files with 24 additions and 2 deletions

BIN
dump.rdb

Binary file not shown.

View File

@ -69,6 +69,11 @@ def getbool():
def getmesscounter(user):
return len(Message.objects.filter(target_user=user))
# WORKDAY HISTORY
@register.simple_tag
def getWorkDayHistory(workday):
workday = Workday.objects.get(pk=workday.pk)
return workday.history.first()
# usergperm
'''

View File

@ -5,6 +5,8 @@ from django.core.exceptions import ValidationError
from colorful.fields import RGBColorField
from django.utils import timezone
from simple_history.models import HistoricalRecords
# Create your models here.
class Workday(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
@ -13,6 +15,7 @@ class Workday(models.Model):
start = models.DateTimeField(default=None, null=True, blank=True)
end = models.DateTimeField(default=None, null=True, blank=True)
target = models.FloatField(default=8.0)
history = HistoricalRecords()
class Breaks(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
@ -20,6 +23,7 @@ class Breaks(models.Model):
workday = models.ForeignKey("Workday", on_delete=models.CASCADE, related_name='workdayele')
start = models.DateTimeField(default=None, null=True, blank=True)
end = models.DateTimeField(default=None, null=True, blank=True)
class AbsenceReason(models.Model):
agency = models.ForeignKey(Agency, on_delete=models.CASCADE)

View File

@ -23,6 +23,7 @@
<th scope="col">Pausen</th>
<th scope="col">Gesamtzeit</th>
<th scope="col">Gleitzeit</th>
<th scope="col">Manuell geändert</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
@ -297,6 +298,18 @@
{% endfor %}
</td>
<td>
{% for workday in workdays %}
{% if workday.end|date:"d-m-y" == da|date:"d-m-y" %}
{% getWorkDayHistory workday as wd_history %}
{% if wd_history.history_user != None %}
{{wd_history.history_date|date:"d.m.Y, H:i"}} von {{wd_history.history_user.first_name}} {{wd_history.history_user.last_name}}
{% endif %}
{% endif %}
{% endfor %}
</td>
<td>
{% counterWDreset %}
@ -319,7 +332,7 @@
{% endfor %}
</td>
{% else %}
<td></td><td></td><td></td><td></td><td style="display: none;"></td><td style="display: none;"></td>
<td></td><td></td><td></td><td></td><td></td><td style="display: none;"></td><td style="display: none;"></td>
{% endif %}
</tr>
{% endfor %}

View File

@ -1492,7 +1492,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:
if(r.representator.usernotifications.absence_user_is_rep_reminder_mail):
sendMailNoti(" in einer Woche startet Ihre Vertretung für " + r.user.first_name + " " + r.user.last_name + "!", user)