emile 2 weeks ago
parent f1620d653b
commit f5c111d90d

@ -386,6 +386,66 @@
</div> </div>
</div> </div>
<!-- MILESTONES -->
<div class="w-full mt-5">
<div
class=" bg-gray-200 rounded-t-md flex justify-between items-center text-white text-xl font-bold h-[50px]">
<div class="px-3">
<p class="text-secondosiblue uppercase font-bold">Milestones</p>
</div>
<a href="{% url 'addmilestone' project.id %}" class="h-full">
<button
class="h-full rounded-tr-md px-4 bg-secondosiblue text-gray-200 text-[18px] outline-none border-none cursor-pointer flex justify-center items-center">
<i class="fa fa-plus"></i>
</button>
</a>
</div>
<div class="overflow-x-auto border border-gray-300 rounded-b-md tableContainer">
<table class="min-w-full divide-y">
<!-- TABLE HEADER -->
<thead class="bg-gray-50">
<tr>
<th scope="col"
class="px-6 py-3 text-sm font-medium text-gray-500 uppercase border-r border-gray-300 whitespace-nowrap">
Name
</th>
<th scope="col"
class="px-6 py-3 text-sm font-medium text-gray-500 uppercase border-r border-gray-300 whitespace-nowrap">
Total Time
</th>
</tr>
</thead>
<!-- TABLE BODY -->
<tbody class="bg-white divide-y divide-gray-200">
{% if milestones %}
{% for m in milestones %}
<tr>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300">
<p class="text-secondosiblue">{{m.name}}</p>
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300">
<p class="text-secondosiblue">{{ m.total_time_worked_hours }}h{{ m.total_time_minutes }}m{{ m.total_time_seconds }}</p>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" class="px-6 py-4 text-center text-sm text-secondosiblue">
No Milestones for this project
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<!-- USER STORIES --> <!-- USER STORIES -->
<div class="w-full mt-5"> <div class="w-full mt-5">

@ -613,6 +613,7 @@ def projectdetails(request, project_id):
stories = UserStory.objects.filter(project=project).order_by('-id') stories = UserStory.objects.filter(project=project).order_by('-id')
credentials = ProjectCredential.objects.filter(project=project).order_by('-id') credentials = ProjectCredential.objects.filter(project=project).order_by('-id')
albums = ProjectFileAlbum.objects.filter(project=project).order_by('-id') albums = ProjectFileAlbum.objects.filter(project=project).order_by('-id')
milestones = Milestone.objects.filter(project=project).order_by('-id')
all_tickets = Ticket.objects.filter(project=project) all_tickets = Ticket.objects.filter(project=project)
all_tickets_with_update_date = all_tickets.annotate( all_tickets_with_update_date = all_tickets.annotate(
@ -641,6 +642,22 @@ def projectdetails(request, project_id):
member.total_time_worked_minutes = total_time_minutes member.total_time_worked_minutes = total_time_minutes
member.total_time_worked_seconds = total_time_seconds member.total_time_worked_seconds = total_time_seconds
for m in milestones:
tasks = project.task_set.filter(milestone=m)
total_time_seconds = 0
for task in tasks:
total_time_hours, total_time_minutes, total_time_seconds_task = task.total_task_time()
total_time_seconds += (total_time_hours * 3600) + (total_time_minutes * 60) + total_time_seconds_task
total_time_hours = total_time_seconds // 3600
total_time_minutes = (total_time_seconds % 3600) // 60
total_time_seconds = total_time_seconds % 60
m.total_time_worked_hours = total_time_hours
m.total_time_worked_minutes = total_time_minutes
m.total_time_worked_seconds = total_time_seconds
context = { context = {
'project': project, 'project': project,
'epics': epics, 'epics': epics,
@ -651,6 +668,7 @@ def projectdetails(request, project_id):
'albums': albums, 'albums': albums,
'statuses' : statuses, 'statuses' : statuses,
'all_tickets_ordered': all_tickets_ordered, 'all_tickets_ordered': all_tickets_ordered,
'milestones': milestones,
'is_pinned': is_pinned, 'is_pinned': is_pinned,
} }

Loading…
Cancel
Save