Skip to content

Commit

Permalink
feat(RNUPackagesProgressView): add elapsed time(
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisig committed Jul 2, 2024
1 parent 1effd8f commit dfa106b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion project/views/RNUPackagesProgressView.py
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

Expand All @@ -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()

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit dfa106b

Please sign in to comment.