File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -235,10 +235,13 @@ async def get_respondents_submit_dates(
235
235
query = query .where (func .date (AnswerSchema .created_at ) <= filters .to_date )
236
236
query = query .where (AnswerSchema .applet_id == applet_id )
237
237
query = query .where (
238
- or_ (
239
- AnswerSchema .id_from_history_id (AnswerSchema .activity_history_id ) == str (filters .activity_or_flow_id ),
240
- AnswerSchema .id_from_history_id (AnswerSchema .flow_history_id ) == str (filters .activity_or_flow_id ),
241
- ),
238
+ case (
239
+ (
240
+ AnswerSchema .flow_history_id .isnot (None ),
241
+ AnswerSchema .id_from_history_id (AnswerSchema .flow_history_id ) == str (filters .activity_or_flow_id ),
242
+ ),
243
+ else_ = AnswerSchema .id_from_history_id (AnswerSchema .activity_history_id ) == str (filters .activity_or_flow_id ),
244
+ )
242
245
)
243
246
244
247
if filters .respondent_id :
You can’t perform that action at this time.
0 commit comments