diff --git a/course/utils.py b/course/utils.py index 0349d80641e20b4a7a0ab1bb68ad0af1bad1eb39..336e980c2c4da3a88e44e6e72d11b6716c913587 100644 --- a/course/utils.py +++ b/course/utils.py @@ -209,15 +209,17 @@ def _eval_participation_tags_conditions( ): # type: (...) -> bool - if not participation: - return False - participation_tags_any_set = ( set(getattr(rule, "if_has_participation_tags_any", []))) participation_tags_all_set = ( set(getattr(rule, "if_has_participation_tags_all", []))) if participation_tags_any_set or participation_tags_all_set: + if not participation: + # Return False for anonymous users if only + # if_has_participation_tags_any or if_has_participation_tags_all + # is not empty. + return False ptag_set = set(participation.tags.all().values_list("name", flat=True)) if not ptag_set: return False