emile 2 months ago
parent 859e817557
commit b7a1587da8

BIN
.DS_Store vendored

Binary file not shown.

BIN
osinaweb/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -522,6 +522,18 @@ def add_daily_report(request):
user = request.user user = request.user
today = date.today() today = date.today()
statuses = Status.objects.filter(staff=user.staffprofile, date_time__date=today) statuses = Status.objects.filter(staff=user.staffprofile, date_time__date=today)
# Calculate total time worked for today
total_time = PointActivity.objects.filter(
point__task__assigned_to=user.staffprofile,
start_time__date=today
).aggregate(Sum('total_time'))['total_time__sum'] or timedelta()
total_seconds = int(total_time.total_seconds())
hours = total_seconds // 3600
minutes = (total_seconds % 3600) // 60
seconds = total_seconds % 60
total_time_text = f'Total working hours: {hours}h {minutes}m {seconds}s'
if request.method == 'POST': if request.method == 'POST':
text = request.POST.get('text') text = request.POST.get('text')
current_datetime = datetime.now() current_datetime = datetime.now()
@ -540,7 +552,7 @@ def add_daily_report(request):
) )
dailyreport.save() dailyreport.save()
status_text = f'Added my daily report.' status_text = f'Added my daily report. <br> <span class="text-green-700">{total_time_text}</span>'
status = Status(text=status_text, date_time=timezone.now(), staff=request.user.staffprofile, type='Daily Report', type_id=dailyreport.id) status = Status(text=status_text, date_time=timezone.now(), staff=request.user.staffprofile, type='Daily Report', type_id=dailyreport.id)
status.save() status.save()

@ -12,12 +12,7 @@ from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer from channels.layers import get_channel_layer
from datetime import timedelta from datetime import timedelta
# Create your models here. # Create your models here.
class Reference(models.Model): class Reference(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
date = models.DateField() date = models.DateField()

@ -166,7 +166,8 @@
<!-- Status --> <!-- Status -->
<div class="w-full"> <div class="w-full">
<p class="text-sm {% if 'Completed' in status.text %} text-green-700 {% else %} text-secondosiblue {% endif %}">{{status.text}}</p> <p class="text-sm {% if 'Completed' in status.text %} text-green-700 {% else %} text-secondosiblue {% endif %}">
{{status.text|safe}}</p>
{% if status.type and status.type_id %} {% if status.type and status.type_id %}
<a {% if status.type == 'Task' and status.type_id %} href="{% url 'detailed-project' status.project %}" {% elif status.type == 'Daily Report' %} href="{% url 'dailyreports' %}" {% endif %}> <a {% if status.type == 'Task' and status.type_id %} href="{% url 'detailed-project' status.project %}" {% elif status.type == 'Daily Report' %} href="{% url 'dailyreports' %}" {% endif %}>

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save