Skip to content

Commit

Permalink
fix(perimeters): distinct user count for inferior levels (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored Jan 28, 2025
1 parent f357442 commit f9e2cbf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions accesses/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def count_allowed_users_in_inferior_levels():


def re_count_allowed_users_inferior_levels(perimeter):
count = 0
user_list = set(Access.objects.filter(accesses_service.q_access_is_valid(), perimeter_id=perimeter.id)
.values_list("profile__user_id", flat=True))
for child in perimeter.children.all():
count += child.count_allowed_users
count += re_count_allowed_users_inferior_levels(perimeter=child)
perimeter.count_allowed_users_inferior_levels = count
user_list.update(re_count_allowed_users_inferior_levels(perimeter=child))
perimeter.count_allowed_users_inferior_levels = len(user_list)
perimeter.save()
return count
return user_list


def count_allowed_users_from_above_levels():
Expand Down

0 comments on commit f9e2cbf

Please sign in to comment.