Skip to content
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
2 changes: 1 addition & 1 deletion hypha/apply/dashboard/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def get_paf_for_review(user, is_paf_approval_sequential):
paf_approvals = PAFApprovals.objects.annotate(
roles_count=Count("paf_reviewer_role__user_roles")
).filter(
roles_count=len(list(user.groups.all())),
roles_count=user.groups.count(),
approved=False,
)

Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/templatetags/project_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def user_next_step_on_project(project, user, request=None):
else:
matched_roles = PAFReviewersRole.objects.annotate(
roles_count=Count("user_roles")
).filter(roles_count=len(user.groups.all()))
).filter(roles_count=user.groups.count())
for group in user.groups.all():
matched_roles = matched_roles.filter(user_roles__id=group.id)
if not matched_roles:
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/views/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def form_valid(self, form):
related=self.object,
)

if len(self.project.invoices.all()) == 1:
if self.project.invoices.count() == 1:
# remove Project waiting invoices task for applicant on first invoice
remove_tasks_for_user(
code=PROJECT_WAITING_INVOICE,
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/todo/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def validate_user_uniqueness(code, user, related_obj):
# if same task is already assigned to user's user_group
user_group_matching_tasks = matching_tasks.annotate(
group_count=Count("user_group")
).filter(group_count=len(user.groups.all()))
).filter(group_count=user.groups.count())
for group in user.groups.all():
user_group_matching_tasks = user_group_matching_tasks.filter(
user_group__id=group.id
Expand All @@ -45,7 +45,7 @@ def validate_user_groups_uniqueness(code, user_groups, related_obj):
)
user_group_matching_tasks = matching_tasks.annotate(
group_count=Count("user_group")
).filter(group_count=len(user_groups))
).filter(group_count=user_groups.count())
for group in user_groups:
user_group_matching_tasks = user_group_matching_tasks.filter(
user_group__id=group.id
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/todo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def remove_tasks_for_user_group(code, user_group, related_obj):
)
user_group_matching_tasks = matching_tasks.annotate(
group_count=Count("user_group")
).filter(group_count=len(user_group.all()))
).filter(group_count=user_group.count())
for group in user_group.all():
user_group_matching_tasks = user_group_matching_tasks.filter(
user_group__id=group.id
Expand Down Expand Up @@ -190,7 +190,7 @@ def get_tasks_for_user(user):
group_count=Count("user_group")
)
user_group_tasks = Task.objects.annotate(group_count=Count("user_group")).filter(
group_count=len(user.groups.all())
group_count=user.groups.count()
)
for group in user.groups.all():
user_group_tasks = user_group_tasks.filter(user_group__id=group.id)
Expand Down
Loading