Skip to content

Commit

Permalink
FWF-3748: [Feature] Included showForOnlyCreateSubmissionUsers(ignore_…
Browse files Browse the repository at this point in the history
…designer) check for submission count
  • Loading branch information
auslin-aot committed Jan 21, 2025
1 parent be2efbc commit f228969
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def get(): # pylint: disable=too-many-locals
is_designer=is_designer,
active_forms=active_forms,
include_submissions_count=include_submissions_count,
ignore_designer=ignore_designer,
)
return (
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def get_all_forms( # pylint: disable=too-many-positional-arguments
is_designer: bool,
active_forms: bool,
include_submissions_count: bool,
ignore_designer: bool,
**kwargs,
): # pylint: disable=too-many-arguments, too-many-locals
"""Get all forms."""
Expand Down Expand Up @@ -93,7 +94,13 @@ def get_all_forms( # pylint: disable=too-many-positional-arguments
)
mapper_schema = FormProcessMapperSchema()
mappers_response = mapper_schema.dump(mappers, many=True)
if include_submissions_count and CREATE_SUBMISSIONS in user.roles:
# Submissions count should return only for user with create_submissions permission
# & client form listing with showForOnlyCreateSubmissionUsers param true
if (
include_submissions_count
and CREATE_SUBMISSIONS in user.roles
and ignore_designer
):
current_app.logger.debug("Fetching submissions count..")
for mapper in mappers_response:
mapper["submissionsCount"] = (
Expand Down

0 comments on commit f228969

Please sign in to comment.