generated from HoloTech/holotech-plugin-template
fix: Correct campaign condition
This commit is contained in:
+7
-5
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user