From ab9905d1ab55ccce5b9ce40d82426adfbe65e1c5 Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 25 Mar 2024 13:51:23 +0200 Subject: [PATCH] sss --- .../__pycache__/urls.cpython-310.pyc | Bin 3481 -> 3495 bytes .../__pycache__/views.cpython-310.pyc | Bin 11823 -> 12464 bytes .../details_templates/timeline-modal.html | 142 +++++------------- osinaweb/osinacore/templates/index.html | 4 +- osinaweb/osinacore/urls.py | 2 +- osinaweb/osinacore/views.py | 34 ++++- 6 files changed, 73 insertions(+), 109 deletions(-) diff --git a/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc index bb1d3cc2f850e5b551fe3edd31d21052d72b9adb..3a6cf4df3f87a63f2d572aa111b350d28b0e48ab 100644 GIT binary patch delta 51 zcmbO!yTWl0%6rM9PJ3Biwd+B9+rKRoK%Tj1aBq<5ih-eh5P%I+U)@9q7!q#@T{bxX` zGieM)k~ApBM5#(l09O*~gGQf;(Wt2B%q}6mILUl-&i9|o zH}ju=P7R(;M{?n?Cg8PT!f5BiXCm_I5Y8POHH`Sd4E5BG56K6!sxqFqN5yX1~-u6!jjxYveq6;P*22XS( z^ki2wMf9YM;K{D^h%nUV1>C?`U{;wEJjD&n2Iqu9$qRa_7jjfL=&EkWlnzUt<|?kd zPhe|Y*;N8Ut>9|i!i*&J2vg;*MkHBI$dzZcIpF|!`fkB9Tpe2^21QT70@|2v%9WTn zW|)CGp<3|5MY~Ecl{&$T_?}WFcv07w4P(Qw8*!tf@*IFLwZRo#-8IbMTap)ZBCcSn z?o8}})Gs7Mo7oY3-y{s^letXRNu`{${d`hln~*I8Co zDn((1Kn7dd1=&nb+icEXNl#ABSXqKkh7Vj#uzZvr)D{WfjaYuxt$2rTnYSQvf^o?=8I#vG=K7 z83A=p>cx%y1nmJG=g8TM(?^3eKuna(l$jYFwV0J1vDl~laH0h+^V5lq@Hzh@aX(zi zcis0csEbrgWIOrytz9wy5Nt$-Z6jFo|9@Q_Ck+3(BW*`vf&bOk7+@zbi?_6QDm0^P z2k&q1s{RJef`*4Ii+hvFW!X+zTjWREAJD%dlLWJ8`BHma`I^ix`Je4Q@H1cA(F@o3 zD;)R;lwaz^Z5X7SA%bB7lPjw> ztvyBNIf4rW7YQyATp_qdaGl@=L4jb2An9-Qu~pOc5wS%BwN4GI5mi;2)zzY=ff&-j G(EbHn2jEQr delta 1130 zcmaKrT}%{L6vsWY%XFBX{Q%iz7g%thY*=7{q$D&^9vcf(#DE$oWtq-ibgNzP&KPUb z*!D&0^NCHHJ`{_nG*rbwO<#(oO&<^qZFt(G@vVL8Lt~6-6Se28oAj-d%gkLGY%ot?AAv~zQ^Vm zei7J&BbYOe<65u^e>1MZ6#ms*tH>$*Di|f>QLF)f37&yzJX9M6n}cy_)8vonbu>am z@hkophF{v0oP>9AB{W!07cbKVWqnHT<8r!>(krC!_J#KXZ5KMbNMS2t(o>T)3 z__XE|s&qCw^0E>>iXJ7qFLtDCFUH2neij=o*@E=l+5yrK?^BP_QgXiB%w)W;JY_lF z3>I$15wbX)Sce?$sat^=??GKe!PZU_hZ|FPuCopon!*7asK%RIXup8|E z<1&3&9K&W9PGFOnfF-Q2Z)lVkDVA1;N>3zef!@Sli%WMOGYi_EutCSoeazf*FK)*Zk z1`&{+SM%yAfN?zEIy6`ey0flzGV2I?wvcmV6)(e$rvtK$^%`L!;JB81+R3{4_l10$ zJzrV!A^;$`!_OC*4*1BgvvpUr-RXo1ZPn369;v zM0#(I8|=@Vq7A)~Nvc1ydmDevq+lEW&I~0Jl{2xkz^WB55FR)xlX0K1#dyfrVWj!| ev7zT|y{>3FXmwgp3u&5WYCVdsgHox3q5liD#wt1h diff --git a/osinaweb/osinacore/templates/details_templates/timeline-modal.html b/osinaweb/osinacore/templates/details_templates/timeline-modal.html index 2d157bce..5552f777 100644 --- a/osinaweb/osinacore/templates/details_templates/timeline-modal.html +++ b/osinaweb/osinacore/templates/details_templates/timeline-modal.html @@ -2,6 +2,7 @@ + @@ -16,110 +17,43 @@

Timeline

-
- -
-
-

Task Time: 560 minutes

-
-
-

User

-
-
-

Date

-
-
-

Total Time

-
-
- - -
- -
-
- -
-
-

Nataly

-
-
-

6-9-2023

-
-
-

360 minutes

-
-
- - -
-
- -
-
-

Salim

-
-
-

12-9-2023

-
-
-

200 minutes

-
-
- - -
-
- -
-
-

Salim

-
-
-

12-9-2023

-
-
-

200 minutes

-
-
- - -
-
- -
-
-

Reine

-
-
-

12-9-2023

-
-
-

200 minutes

-
-
- - -
-
- -
-
-

Nataly

-
-
-

12-9-2023

-
-
-

200 minutes

-
-
-
+
+ + + + + + + + + {% for date, total_hours, total_minutes, total_seconds in formatted_totals %} + + + + + {% endfor %} + +
+ Date + Total Time Worked
{{ date }}

+ {% if total_hours == 1 %} + {{ total_hours }}hr, + {% else %} + {{ total_hours }}hrs, + {% endif %} + {% if total_minutes == 1 %} + {{ total_minutes }}min, + {% else %} + {{ total_minutes }}mins, + {% endif %} + {% if total_seconds == 1 %} + {{ total_seconds }}sec + {% else %} + {{ total_seconds }}secs + {% endif %} +

diff --git a/osinaweb/osinacore/templates/index.html b/osinaweb/osinacore/templates/index.html index 5bbeddba..c3863c56 100644 --- a/osinaweb/osinacore/templates/index.html +++ b/osinaweb/osinacore/templates/index.html @@ -131,7 +131,7 @@ + data-modal-url="{% url 'timeline' task.task_id %}">Timeline
@@ -237,7 +237,7 @@ + data-modal-url="{% url 'timeline' task.task_id %}">Timeline diff --git a/osinaweb/osinacore/urls.py b/osinaweb/osinacore/urls.py index baaa66f6..0dfbc04d 100644 --- a/osinaweb/osinacore/urls.py +++ b/osinaweb/osinacore/urls.py @@ -56,7 +56,7 @@ urlpatterns = [ path('projectdetails//', views.projectdetails, name='detailed-project'), path('tasks//', views.taskdetails, name='detailed-task'), path('show-points//', views.show_points_modal, name='showpoints'), - path('timeline/', views.timeline_modal, name='timeline'), + path('timeline//', views.timeline_modal, name='timeline'), #Fetch urls diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index 98690d3c..07c28e7c 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -352,9 +352,39 @@ def show_points_modal(request, task_id): } return render(request, 'details_templates/showpoints-modal.html', context) -def timeline_modal(request, *args, **kwargs): - context = { + + + + +def timeline_modal(request, task_id): + task = Task.objects.get(task_id=task_id) + point_activities = PointActivity.objects.filter(point__task=task) + # Dictionary to store total time worked on each day + daily_totals = {} + + for activity in point_activities: + date = activity.start_time.date() + hours, minutes, seconds = activity.total_time_in_hours_minutes_seconds() + total_time = timedelta(hours=hours, minutes=minutes, seconds=seconds) + + # Add the total time to the corresponding day's total + if date in daily_totals: + daily_totals[date] += total_time + else: + daily_totals[date] = total_time + + sorted_daily_totals = sorted(daily_totals.items()) + formatted_totals = [] + for date, total_time in sorted_daily_totals: + total_hours = total_time.days * 24 + total_time.seconds // 3600 + total_minutes = (total_time.seconds % 3600) // 60 + total_seconds = total_time.seconds % 60 + formatted_totals.append((date, total_hours, total_minutes, total_seconds)) + context = { + 'task': task, + 'sorted_daily_totals': sorted_daily_totals, + 'formatted_totals':formatted_totals, } return render(request, 'details_templates/timeline-modal.html', context)