Skip to content

Commit

Permalink
fix filters
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarinas committed Jul 17, 2023
1 parent 340534c commit 82705e0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/client/src/client-common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export function computeProposalStatus(
return ProposalStatus.PENDING;
}
if (
(proposal.potentiallyExecutable || proposal.earlyExecutable) &&
endDate >= now
(now > endDate || proposal.earlyExecutable) &&
proposal.potentiallyExecutable
) {
return ProposalStatus.SUCCEEDED;
}
Expand All @@ -67,21 +67,22 @@ export function computeProposalStatusFilter(
const now = Math.round(new Date().getTime() / 1000).toString();
switch (status) {
case ProposalStatus.PENDING:
where = { startDate_gte: now };
where = { startDate_gte: now, potentiallyExecutable: false, executed: false };
break;
case ProposalStatus.ACTIVE:
where = { startDate_lt: now, endDate_gte: now, executed: false };
where = { startDate_lt: now, endDate_gte: now, executed: false, potentiallyExecutable: false };
break;
case ProposalStatus.EXECUTED:
where = { executed: true };
break;
case ProposalStatus.SUCCEEDED:
where = { potentiallyExecutable: true, endDate_lt: now };
where = { potentiallyExecutable: true };
break;
case ProposalStatus.DEFEATED:
where = {
endDate_lt: now,
executed: false,
potentiallyExecutable: false,
};
break;
default:
Expand Down

0 comments on commit 82705e0

Please sign in to comment.