Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fix #817

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion backend/utils/convert_result_to_chitralekha_format.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
def create_memory(result):
memory = {}
for i in range(len(result)):
key = result[i]["id"]
try:
key = result[i]["id"]
except KeyError:
print(
f"The entry number {i} is not having an id hence cannot be converted to CL_format"
)
del result[i]
continue
if key not in memory:
memory[key] = {"labels_dict_idx": -1, "text_dict_idx": -1}
if result[i]["type"] == "labels":
Expand All @@ -12,6 +19,8 @@ def create_memory(result):


def convert_result_to_chitralekha_format(result, ann_id):
if len(result) == 1 and result[0] == {}:
return [{}]
memory = create_memory(result)
modified_result = []
count = 1
Expand Down
19 changes: 16 additions & 3 deletions backend/workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,9 @@ def project_analytics(self, request, pk=None):
for each_task in labeled_tasks:
try:
annotate_annotation = Annotation.objects.filter(
task=each_task, annotation_type=ANNOTATOR_ANNOTATION
task=each_task,
annotation_type=ANNOTATOR_ANNOTATION,
annotation_status__in=["labeled"],
)[0]
total_duration_annotated_count_list.append(
get_audio_transcription_duration(
Expand All @@ -1282,7 +1284,13 @@ def project_analytics(self, request, pk=None):
for each_task in reviewed_tasks:
try:
review_annotation = Annotation.objects.filter(
task=each_task, annotation_type=REVIEWER_ANNOTATION
task=each_task,
annotation_type=REVIEWER_ANNOTATION,
annotation_status__in=[
"accepted",
"accepted_with_minor_changes",
"accepted_with_major_changes",
],
)[0]
total_duration_reviewed_count_list.append(
get_audio_transcription_duration(
Expand Down Expand Up @@ -1311,7 +1319,12 @@ def project_analytics(self, request, pk=None):
for each_task in superchecked_tasks:
try:
supercheck_annotation = Annotation.objects.filter(
task=each_task, annotation_type=SUPER_CHECKER_ANNOTATION
task=each_task,
annotation_type=SUPER_CHECKER_ANNOTATION,
annotation_status__in=[
"validated",
"validated_with_changes",
],
)[0]
total_duration_superchecked_count_list.append(
get_audio_transcription_duration(
Expand Down
Loading