-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RNUPackagesProgressView): add elapsed time(
- Loading branch information
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from django.db.models import F, IntegerField, Sum | ||
from django.db.models.functions import Cast | ||
from django.utils import timezone | ||
from rest_framework.response import Response | ||
from rest_framework.views import APIView | ||
|
||
|
@@ -18,8 +19,10 @@ def get(self, request): | |
) | ||
of_those_with_ocsge_count = of_those_with_ocsge.count() | ||
diagnostic_to_create_count = diagnostic_to_create.count() | ||
mda_user = User.objects.get(email="[email protected]") | ||
|
||
diagnostic_created = Project.objects.filter( | ||
user=User.objects.get(email="[email protected]"), | ||
user=mda_user, | ||
) | ||
diagnostic_created_count = diagnostic_created.count() | ||
|
||
|
@@ -59,8 +62,14 @@ def get(self, request): | |
) | ||
) | ||
|
||
time_diff = timezone.now() - mda_user.date_joined | ||
hours = time_diff.seconds // 3600 | ||
minutes = (time_diff.seconds % 3600) // 60 | ||
seconds = time_diff.seconds % 60 | ||
|
||
return Response( | ||
{ | ||
"elapsed_time": f"{hours}h {minutes}m {seconds}s", | ||
"diagnostic_to_create_count": diagnostic_to_create_count, | ||
"of_those_with_ocsge_count": of_those_with_ocsge_count, | ||
"diagnostic_created_count": diagnostic_created_count, | ||
|