Skip to content

Commit

Permalink
fix: improving logic for querying flux or activity id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramir Mesquita committed Dec 10, 2024
1 parent 41debc8 commit cd6af87
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/apps/answers/crud/answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ async def get_respondents_submit_dates(
query = query.where(func.date(AnswerSchema.created_at) <= filters.to_date)
query = query.where(AnswerSchema.applet_id == applet_id)
query = query.where(
or_(
AnswerSchema.id_from_history_id(AnswerSchema.activity_history_id) == str(filters.activity_or_flow_id),
AnswerSchema.id_from_history_id(AnswerSchema.flow_history_id) == str(filters.activity_or_flow_id),
),
case(
(
AnswerSchema.flow_history_id.isnot(None),
AnswerSchema.id_from_history_id(AnswerSchema.flow_history_id) == str(filters.activity_or_flow_id),
),
else_=AnswerSchema.id_from_history_id(AnswerSchema.activity_history_id) == str(filters.activity_or_flow_id),
)
)

if filters.respondent_id:
Expand Down

0 comments on commit cd6af87

Please sign in to comment.