From 10a5edaac658d070a6091fd503da21f5ab6e5864 Mon Sep 17 00:00:00 2001 From: Rahul-538 Date: Tue, 1 Oct 2024 08:32:01 +0530 Subject: [PATCH 1/2] minor fix in get celery task --- backend/tasks/views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/tasks/views.py b/backend/tasks/views.py index 430cfd0f..467e0326 100644 --- a/backend/tasks/views.py +++ b/backend/tasks/views.py @@ -2430,20 +2430,20 @@ def get_celery_tasks(request): filtered_tasks[i]["name"] = Queued_Task_name[filtered_tasks[i]["name"]] for i in filtered_tasks: if filtered_tasks[i]["succeeded"] is not None: - filtered_tasks[i]["succeeded"] = timezone.datetime.utcfromtimestamp( - filtered_tasks[i]["succeeded"] + filtered_tasks[i]["succeeded"] = datetime.fromtimestamp( + filtered_tasks[i]["succeeded"],tz=timezone.utc ).strftime("%Y-%m-%dT%H:%M:%S.%fZ") if filtered_tasks[i]["failed"] is not None: - filtered_tasks[i]["failed"] = timezone.datetime.utcfromtimestamp( - filtered_tasks[i]["failed"] + filtered_tasks[i]["failed"] = datetime.fromtimestamp( + filtered_tasks[i]["failed"],tz=timezone.utc ).strftime("%Y-%m-%dT%H:%M:%S.%fZ") if filtered_tasks[i]["started"] is not None: - filtered_tasks[i]["started"] = timezone.datetime.utcfromtimestamp( - filtered_tasks[i]["started"] + filtered_tasks[i]["started"] = datetime.fromtimestamp( + filtered_tasks[i]["started"],tz=timezone.utc ).strftime("%Y-%m-%dT%H:%M:%S.%fZ") if filtered_tasks[i]["received"] is not None: - filtered_tasks[i]["received"] = timezone.datetime.utcfromtimestamp( - filtered_tasks[i]["received"] + filtered_tasks[i]["received"] = datetime.fromtimestamp( + filtered_tasks[i]["received"],tz=timezone.utc ).strftime("%Y-%m-%dT%H:%M:%S.%fZ") if "error" in filtered_tasks: From 8f52f24a8bbc02e175c95b332be2168d6beac8ba Mon Sep 17 00:00:00 2001 From: Rahul-538 Date: Tue, 10 Dec 2024 12:37:48 +0530 Subject: [PATCH 2/2] minor change in guest authentication --- backend/workspaces/views.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/workspaces/views.py b/backend/workspaces/views.py index dcbb5f10..df717f61 100644 --- a/backend/workspaces/views.py +++ b/backend/workspaces/views.py @@ -34,7 +34,7 @@ get_audio_project_types, get_audio_transcription_duration, get_audio_segments_count, - calculate_word_error_rate_between_two_audio_transcription_annotation, + calculate_word_error_rate_between_two_llm_prompts, get_translation_dataset_project_types, convert_hours_to_seconds, ocr_word_count, @@ -64,6 +64,7 @@ get_review_reports, get_supercheck_reports, ) +from projects.registry_helper import ProjectRegistry # Create your views here. @@ -160,7 +161,10 @@ def list_guest_workspaces(self, request): try: # Filter workspaces where guest_workspace is True guest_workspaces = Workspace.objects.filter(guest_workspace=True) + authenticated_workspaces = guest_workspaces.filter(members=request.user) serializer = WorkspaceSerializer(guest_workspaces, many=True) + for workspace in serializer.data: + workspace["is_autheticated"]= workspace["id"] in authenticated_workspaces.values_list("id",flat=True) return Response(serializer.data, status=status.HTTP_200_OK) except Exception as e: return Response( @@ -900,7 +904,7 @@ def project_analytics(self, request, pk=None): ) ) total_word_error_rate_ar_list.append( - calculate_word_error_rate_between_two_audio_transcription_annotation( + calculate_word_error_rate_between_two_llm_prompts( review_annotation.result, review_annotation.parent_annotation.result, ) @@ -934,7 +938,7 @@ def project_analytics(self, request, pk=None): ) ) total_word_error_rate_rs_list.append( - calculate_word_error_rate_between_two_audio_transcription_annotation( + calculate_word_error_rate_between_two_llm_prompts( supercheck_annotation.result, supercheck_annotation.parent_annotation.result, ) @@ -2899,6 +2903,13 @@ def send_user_analytics(self, request, pk=None): + str(from_date) + str(to_date) ) + project_type = request.data.get("project_type") + pr = ProjectRegistry.get_instance() + if project_type not in pr.project_types.keys(): + return Response( + {"message": "This project type does not exist."}, + status=status.HTTP_400_BAD_REQUEST, + ) celery_lock = Lock(user_id, task_name) try: lock_status = celery_lock.lockStatus()