Skip to content

Commit

Permalink
fix: proposal counts (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
baiirun authored Jan 10, 2025
1 parent be32032 commit 77070a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion apps/web/app/space/[id]/governance/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ async function getProposalsCount({ id }: Props['params']) {
filter: {
spaceId: { equalToInsensitive: "${id}" }
status: { equalTo: PROPOSED }
endTime: { greaterThanOrEqualTo: ${Math.floor(Date.now() / 1000)} }
or: [
{ type: { equalTo: ADD_EDIT } }
{ type: { equalTo: ADD_SUBSPACE } }
{ type: { equalTo: REMOVE_SUBSPACE } }
]
}
) {
totalCount
Expand All @@ -105,6 +111,11 @@ async function getProposalsCount({ id }: Props['params']) {
filter: {
spaceId: { equalToInsensitive: "${id}" }
status: { equalTo: ACCEPTED }
or: [
{ type: { equalTo: ADD_EDIT } }
{ type: { equalTo: ADD_SUBSPACE } }
{ type: { equalTo: REMOVE_SUBSPACE } }
]
}
) {
totalCount
Expand All @@ -113,7 +124,13 @@ async function getProposalsCount({ id }: Props['params']) {
rejectedProposals: proposals(
filter: {
spaceId: { equalToInsensitive: "${id}" }
status: { equalTo: REJECTED }
status: { in: [REJECTED, PROPOSED] }
endTime: { greaterThanOrEqualTo: ${Math.floor(Date.now() / 1000)} }
or: [
{ type: { equalTo: ADD_EDIT } }
{ type: { equalTo: ADD_SUBSPACE } }
{ type: { equalTo: REMOVE_SUBSPACE } }
]
}
) {
totalCount
Expand Down
4 changes: 2 additions & 2 deletions apps/web/partials/governance/governance-proposals-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface Props {
export async function GovernanceProposalsList({ spaceId, page }: Props) {
const connectedAddress = cookies().get(WALLET_ADDRESS)?.value;
const [proposals, profile] = await Promise.all([
fetchActiveProposals({ spaceId, first: 5, page, connectedAddress }),
fetchProposals({ spaceId, first: 5, page, connectedAddress }),
connectedAddress ? fetchProfile({ address: connectedAddress }) : null,
]);

Expand Down Expand Up @@ -288,7 +288,7 @@ const allProposalsQuery = (spaceId: string, first: number, skip: number, connect
}
`;

async function fetchActiveProposals({
async function fetchProposals({
spaceId,
connectedAddress,
first = 5,
Expand Down

0 comments on commit 77070a9

Please sign in to comment.