From 04eefa4e0e7642330a72fe527932261d4aa69131 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Sun, 4 Sep 2016 13:54:05 +1000 Subject: [PATCH] Passes first two tests --- registrasion/controllers/conditions.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/registrasion/controllers/conditions.py b/registrasion/controllers/conditions.py index f9007096..7ca8e431 100644 --- a/registrasion/controllers/conditions.py +++ b/registrasion/controllers/conditions.py @@ -310,6 +310,17 @@ class SpeakerConditionController(IsMetByFilter, ConditionController): ''' Returns all of the items from queryset which are enabled by a user being a presenter or copresenter of a proposal. ''' - # User is a presenter + u = user - return queryset.filter(proposal_kind__section__presentations__speaker__user=user) + # User is a presenter + user_is_presenter = Q( + is_presenter=True, + proposal_kind__section__presentations__speaker__user=u, + ) + # User is a copresenter + user_is_copresenter = Q( + is_copresenter=True, + proposal_kind__section__presentations__additional_speakers__user=u, + ) + + return queryset.filter(user_is_presenter | user_is_copresenter)