fix: Correct campaign condition

This commit is contained in:
2026-07-30 13:39:06 +03:00
parent f61d0519ee
commit 87aec03e57
+7 -5
View File
@@ -204,15 +204,17 @@ class CampaignRegistry:
condition = Campaign.communityid == cid condition = Campaign.communityid == cid
if active is not None: if active is not None:
active_condition = ( active_condition = (Campaign.started_at != NULL) & (
Campaign.started_at != NULL and Campaign.completed_at == NULL Campaign.completed_at == NULL
) )
if active: if active:
condition = condition and active_condition condition = condition & active_condition
else: else:
condition = condition and ~active_condition condition = condition & ~active_condition
rows = await Campaign.fetch_where(condition) rows = await Campaign.fetch_where(
condition,
)
campaigns = [RewardCampaign(row, session=self._session) for row in rows] campaigns = [RewardCampaign(row, session=self._session) for row in rows]
return campaigns return campaigns