From 4ce3ea4dbe86f08bff638a7532fdff082ac736ca Mon Sep 17 00:00:00 2001 From: Aaron Date: Sat, 16 Feb 2019 10:31:10 -0600 Subject: [PATCH] hook up proposal stage filters --- admin/src/util/filters.ts | 9 +++++++++ admin/src/util/statuses.ts | 28 ++++++++++++++++++++++++++++ backend/grant/utils/pagination.py | 4 +--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/admin/src/util/filters.ts b/admin/src/util/filters.ts index 0d44d0b1..6813ac27 100644 --- a/admin/src/util/filters.ts +++ b/admin/src/util/filters.ts @@ -4,6 +4,7 @@ import { CONTRIBUTION_STATUSES, PROPOSAL_ARBITER_STATUSES, MILESTONE_STAGES, + PROPOSAL_STAGES, } from './statuses'; export interface Filter { @@ -35,6 +36,14 @@ const PROPOSAL_FILTERS = PROPOSAL_STATUSES.map(s => ({ group: 'Status', })) // proposal has extra filters + .concat( + PROPOSAL_STAGES.map(s => ({ + id: `STAGE_${s.id}`, + display: `Stage: ${s.tagDisplay}`, + color: s.tagColor, + group: 'Stage', + })), + ) .concat( PROPOSAL_ARBITER_STATUSES.map(s => ({ id: `ARBITER_${s.id}`, diff --git a/admin/src/util/statuses.ts b/admin/src/util/statuses.ts index 6f965979..a470c8b6 100644 --- a/admin/src/util/statuses.ts +++ b/admin/src/util/statuses.ts @@ -4,6 +4,7 @@ import { CONTRIBUTION_STATUS, PROPOSAL_ARBITER_STATUS, MILESTONE_STAGE, + PROPOSAL_STAGE, } from 'src/types'; export interface StatusSoT { @@ -92,6 +93,33 @@ export const PROPOSAL_STATUSES: Array> = [ }, ]; +export const PROPOSAL_STAGES: Array> = [ + { + id: PROPOSAL_STAGE.PREVIEW, + tagDisplay: 'Preview', + tagColor: '#afd500', + hint: 'Proposal is not yet published.', + }, + { + id: PROPOSAL_STAGE.FUNDING_REQUIRED, + tagDisplay: 'Funding', + tagColor: '#bebebe', + hint: 'Proposal has been published but still needs funding.', + }, + { + id: PROPOSAL_STAGE.WIP, + tagDisplay: 'WIP', + tagColor: '#8d8d8d', + hint: 'Proposal is fully funded and the work is being done.', + }, + { + id: PROPOSAL_STAGE.COMPLETED, + tagDisplay: 'Completed', + tagColor: '#108ee9', + hint: 'Proposal was accepted, published, funded and all funds paid out.', + }, +]; + export const PROPOSAL_ARBITER_STATUSES: Array> = [ { id: PROPOSAL_ARBITER_STATUS.MISSING, diff --git a/backend/grant/utils/pagination.py b/backend/grant/utils/pagination.py index 680bd46b..58d78562 100644 --- a/backend/grant/utils/pagination.py +++ b/backend/grant/utils/pagination.py @@ -84,10 +84,8 @@ class ProposalPagination(Pagination): if status_filters: query = query.filter(Proposal.status.in_(status_filters)) - # TODO: figure out what is going to happen with stages if stage_filters: - self._raise('stage filters not yet supported') - # query = query.filter(Proposal.stage.in_(stage_filters)) + query = query.filter(Proposal.stage.in_(stage_filters)) if cat_filters: query = query.filter(Proposal.category.in_(cat_filters)) if arbiter_filters: