From 1a45d8584fdfd9b0ec5ec6392cb5f9962b4ee98e Mon Sep 17 00:00:00 2001 From: Dennis Wambua Date: Tue, 16 Nov 2021 16:42:18 +0300 Subject: [PATCH] Use submitted_by common tag --- onadata/libs/data/query.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/onadata/libs/data/query.py b/onadata/libs/data/query.py index 16f7053022..372238f04a 100644 --- a/onadata/libs/data/query.py +++ b/onadata/libs/data/query.py @@ -2,7 +2,8 @@ from django.conf import settings from django.db import connection -from onadata.libs.utils.common_tags import SUBMISSION_TIME +from onadata.libs.utils.common_tags import ( + SUBMISSION_TIME, SUBMITTED_BY) from onadata.apps.logger.models.data_view import DataView @@ -93,7 +94,7 @@ def _postgres_count_group(field, name, xform, data_view=None): additional_filters = _additional_data_view_filters(data_view) # Use left join to the auth user model for better performance. - if field == "_submitted_by": + if field == SUBMITTED_BY: string_args["json"] = "au.username" string_args["join"] = "i LEFT JOIN auth_user au ON au.id = i.user_id"