From 453f3b9ea229b6460508d162e7706b00a478bd4f Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 25 Mar 2024 11:49:47 +0200 Subject: [PATCH] New changes in task details --- osinaweb/db.sqlite3 | Bin 983040 -> 983040 bytes .../edit/__pycache__/urls.cpython-310.pyc | Bin 1655 -> 1759 bytes .../edit/__pycache__/views.cpython-310.pyc | Bin 10156 -> 9900 bytes osinaweb/osinacore/edit/urls.py | 2 +- osinaweb/osinacore/edit/views.py | 52 ++- .../osinacore/templates/add-edit-main.html | 6 +- .../details_templates/task-details.html | 301 +++++++----------- osinaweb/osinacore/templates/main.html | 6 +- osinaweb/static/dist/output.css | 15 - osinaweb/static/images/back-in-time.png | Bin 0 -> 8887 bytes 10 files changed, 168 insertions(+), 214 deletions(-) create mode 100644 osinaweb/static/images/back-in-time.png diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index ff815cec6f7bb9462ea24fdd1d45fc49e0310e66..b0d350e605a2d3226af1219cbd1f57731d9d9bb2 100644 GIT binary patch delta 993 zcmah|O>7fK6yDkO{*1RfkOl})3Nay7D)4%Cy~bV_l$!9TL@ogog$992Vgn}FUa%7b z7wjUDO9d_o88{$uK!OVgl%P4lA*Y@Q5Gx1;sfsH^D+C0>1yw3-$3grfAFuPS~89{#$hNqorZ?afzWXO@E(Lob)70dR(r-W&j>{s(#y3>@qA(Ow@o zF(M@Sn?!yFCV2klP}Rs|K%P7YvuD|1%$A{B*pE#+)5n4gJcB@=Ja-8@(d!d_+YSbT z^xsxdIw^S3Z$vJO?JhLRc0ZNH74$?|3?U>5fX7_vl^g3DpAs1)2APgeDfkbeMVln@ zZP@S9{?aCykcdW}{tiX8#0|&-&vRp3KV^ZrO9iib@wDu2cd6IaitL1p-YmQ>9g7j$%s>DD|v^9^OK zlm1fHnvf(4kmp{|J5!pkO3;-Hr)9LAXU;*3uIAA)MW`?2$SnocyqSiDv4unQhJr#H zggSVZ$gQYRaa-^|I10})xh+sK1|5lOB)(~J-r`z+Cf=1Xv1xg+-)jcg)cyY2NYpo& zmbmYT=Mk(Sm*=?Qf_F)CFePyj&)2Zh7s+)XkDH}omWBtDWV*(^a9)LZziNf1dpgj$ zdZ9r&OyoR@x}ubUaAO}-z+rztw@t$mL*|aVl)gNUWC(&pETYvs_^1E-^Ez>g$VGdL zCS<4RN=K@ z4&Bp+S(}%%hM(&)V)R&Bnas@o$-Fj*2yM|;P_QBYjK-wYKc$E$6myY+B8b!$wbmRY9$gU{ zC{ouh%jiMSqelrc*B(6-2_dBzD6R*Ou1yp{WX19Dd50f7zOFm%y3^h$>^vWvr8`FM zPW#=$iwyi~#hLp6%dLCahX8H=YtDm>Cyl&n7PnAkjrE0ERI8`j4RDWxfJtGaASr6$!>4p^lpQKt3X$9rWh^7+7 zea&t}HKuXZjm*Lqa#4Jjylwfqctyz1yB1YHcdg;WB;#}fZqMtz?j%PZ*A6s0j;%Rb zN_8A@yi2mUt)pT>PKM&9S_{Q_WQGC7{0X%kiF}%5&8>jrwV;k;fs3j4YdB&iZ?D{% zlrs$X50$FbLd7unnNgUzytt^gOsrfWhwLTEYj{?tCv3HJ6<-}8M_DYni*tH=%T&CI z+=8;C9-j8kz0NV1bymew)$niu;F4Uqi{t*EH-Yjt@WC7d>>1e8uWeMl2#*0ZVykaR ayKX*G%{{Dw`q0O;>DO+ItNw2sV*dbK0Hibk diff --git a/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc index 4f212282c2cf09b72fa5b0f19c1228d68ae90f3c..3d5378ad91ed6404bf051f5da2a62ae50e14b16b 100644 GIT binary patch delta 150 zcmey)bDvi`pO=@50SLZ2Gp6aYGcY^`agc!+kmCTv#WEYUIThNYg7QERdfn4SX!K#5?_*73=~OBPd&p3RJI4zzbxs0kJa>e>U1&sHo1!Um}(wRKuJlo+8}K6wI)4@>V5R#;VD`mEDh*$|CR)L7slXH~KCr^+AD&hq?U7m66bPEHgcsTSOz=2BSqBrmkk zONHjp&aEOOV5_zwN~wMY4_^Ez1y735nc9K*&12rYnfddM=8v8`Z*99*BYSy#*Vw6j zc7~yFI*|tv%0*2+`t=HKUD(8h(g{ceze@ZVRB_$k&}9nuJrDo*vs6$U3H%?_X4T+k z|1CpNkWZ6uJ_CH}PGWxa+Eqq#uw}>jFstk}2y<<{<-`T$d;pq>L%|H(;G4k13BN~| zMcfXm1AEjW`o{Rq*k>HzRWQ}J!bgjdB*+XcRf0pTmX|R#QpB(20dWa5e-eL}A6r6q zz=G%ui>?b_@I`6*U2Jv|T}_FVloB1$)j(5bGrgmQ=C0mK#;6TY4U?oQ7g}wdH1yP?9B=fKvCTMTd}6d24aRGNe8BR=KY0hZ<;|Ig zl*RYuAsino$!p%cK$*0j20@!!M%L)1m^M73qetg-S(h#@k6onr1EMp=IX//', views.mark_point_completed, name='mark_point_completed'), path('mark_point_completed_task_page///', views.mark_point_completed_task_page, name='mark_point_completed_task_page'), path('mark_point_paused///', views.mark_point_paused, name='mark_point_paused'), - + path('mark_point_paused_task_page///', views.mark_point_paused, name='mark_point_paused_task_page'), ] \ No newline at end of file diff --git a/osinaweb/osinacore/edit/views.py b/osinaweb/osinacore/edit/views.py index f898fc53..c50bf020 100644 --- a/osinaweb/osinacore/edit/views.py +++ b/osinaweb/osinacore/edit/views.py @@ -457,6 +457,32 @@ def mark_point_paused(request, point_id, task_id): +@login_required +def mark_point_paused_task_page(request, point_id, task_id): + task = get_object_or_404(Task, id=task_id) + point = get_object_or_404(Point, id=point_id) + point.status = 'Paused' + current_datetime = datetime.now() + + point.save() + + last_activity = PointActivity.objects.filter(point=point).last() + if last_activity: + last_activity.end_time = timezone.make_aware(current_datetime, timezone.get_current_timezone()) + last_activity.save() + + status_text = f'{point.text} - Paused' + status = Status(text=status_text, date=current_datetime.date(), time=current_datetime.strftime("%I:%M %p"), staff=request.user.staffprofile) + status.save() + + + task_id_str = task.task_id + + showpoints_url = reverse('showpoints', args=[task_id_str]) + return HttpResponseRedirect(showpoints_url) + + + @login_required def mark_point_completed(request, point_id, task_id): task = get_object_or_404(Task, id=task_id) @@ -491,9 +517,7 @@ def mark_point_completed(request, point_id, task_id): status = Status(text=status_text, date=current_datetime.date(), time=current_datetime.strftime("%I:%M %p"), staff=request.user.staffprofile) status.save() - task_id_str = task.task_id - showpoints_url = reverse('showpoints', args=[task_id_str]) - return HttpResponseRedirect(showpoints_url) + return redirect('detailed-task', task_id=task.task_id) @@ -502,18 +526,32 @@ def mark_point_completed_task_page(request, point_id, task_id): task = get_object_or_404(Task, id=task_id) point = get_object_or_404(Point, id=point_id) point.status = 'Completed' - current_datetime = datetime.now() + current_datetime = datetime.now() point.save() - + # Update the end time of the last activity to the current time last_activity = PointActivity.objects.filter(point=point).last() - last_activity.end_time = datetime.now() - last_activity.save() + if last_activity: + last_activity.end_time = timezone.make_aware(current_datetime, timezone.get_current_timezone()) + last_activity.save() + + total_time_hours, total_time_minutes, total_time_seconds = point.total_activity_time() + + formatted_time = "" + if total_time_hours > 0: + formatted_time += f"{total_time_hours}{'hr' if total_time_hours == 1 else 'hrs'}" + if total_time_minutes > 0: + formatted_time += f" {total_time_minutes}{'min' if total_time_minutes == 1 else 'mins'}" + if total_time_seconds > 0: + formatted_time += f" {total_time_seconds}{'sec' if total_time_seconds == 1 else 'secs'}" status_text = f'{point.text} - Completed' + if formatted_time: + status_text += f' in {formatted_time}' + status = Status(text=status_text, date=current_datetime.date(), time=current_datetime.strftime("%I:%M %p"), staff=request.user.staffprofile) status.save() diff --git a/osinaweb/osinacore/templates/add-edit-main.html b/osinaweb/osinacore/templates/add-edit-main.html index 6c117e33..f21b2bcd 100644 --- a/osinaweb/osinacore/templates/add-edit-main.html +++ b/osinaweb/osinacore/templates/add-edit-main.html @@ -585,7 +585,7 @@
-

Tasks

+

Tasks

-

Projects

+

Projects

-

Tickets

+

Tickets

- {% if task.status == 'Open' %} -
-

{{task.name}}

-
- {% endif %} - {% if task.status == 'Working On' %} -
-

{{task.name}}

-
- {% endif %} - {% if task.status == 'Closed' %} -
+ +

{{task.name}}

- {% endif %} -
+ +
+
+ +

Total Time: {{ task.total_task_time.0 }}{% if task.total_task_time.0 == 1 %}hr{% else %}hrs{% endif %} {{ task.total_task_time.1 }}{% if task.total_task_time.1 == 1 %}min{% else %}mins{% endif %} {{ task.total_task_time.2 }}{% if task.total_task_time.2 == 1 %}sec{% else %}secs{% endif %}

+ +
+
-
- - - - - - - - - - - - +
{% if points %} {% for point in points %} -
- - - {% if point.status == 'Not Completed' %} - - {% endif %} - - {% if point.status == 'Completed' %} - - {% endif %} - - {% if point.status == 'Working On' %} - - {% endif %} - + + +
+
+

Total Time: + + {{ point.total_activity_time.0 }} hours, + {{ point.total_activity_time.1 }} minutes, + {{ point.total_activity_time.2 }} seconds + +

+
+ +
+ {% if point.status == 'Completed' %} +

Completed

+ {% elif point.status == 'Working On' %} +

Working On

+ {% elif point.status == 'Paused' %} +

Paused

+ {% else %} +

Created

+ {% endif %} +
+
+ {% endfor %} {% else %} @@ -200,96 +217,10 @@ - - -
-
-
-
-

Timline

-
- - -
- -
-
- Point - - Status -
-

{{point.text}}

-
-
-
- {% csrf_token %} - -
-
- {% csrf_token %} - -
-
- {% csrf_token %} - -
+ +
+
+
+ {% if point.status == 'Completed' %} +

{{point.text}}

+ {% else %} +

{{point.text}}

+ {% endif %}
-
- - -
+
+ {% if point.status == 'Not Completed' or point.status == 'Paused' and not point.status == 'Completed' %} + + + + {% endif %} + + {% if point.status == 'Working On' and not point.status == 'Completed' %} + + + + {% endif %} + + {% if not point.status == 'Completed' and not point.status == 'Paused' %} + + + + {% endif %} + + + {% if point.status == 'Completed' %} -
+ class="w-[40px] h-[40px] rounded-full bg-transparent shadow-md text-white border border-white flex justify-center items-center opacity-30 cursor-default"> + + + {% endif %} + + {% if not point.status == 'Completed' %} + {% csrf_token %} -
-
- {% csrf_token %} -
+ {% endif %}
-
- - - - - - - - - - - - - - - - - - - - - - - - -
- Task Time: 300 min - - User - - Date - - Total Time -
- - - Nataly - - 6-9-2023 - - 50min -
-
-
-
- - - - -
-

Description:

-
-

- {{task.description}} -

-
-
- - - -
+

Tags:

-
+
@@ -308,7 +239,7 @@ -