hook up proposal stage filters

This commit is contained in:
Aaron 2019-02-16 10:31:10 -06:00
parent 84dd969136
commit 4ce3ea4dbe
No known key found for this signature in database
GPG Key ID: 3B5B7597106F0A0E
3 changed files with 38 additions and 3 deletions

View File

@ -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}`,

View File

@ -4,6 +4,7 @@ import {
CONTRIBUTION_STATUS,
PROPOSAL_ARBITER_STATUS,
MILESTONE_STAGE,
PROPOSAL_STAGE,
} from 'src/types';
export interface StatusSoT<E> {
@ -92,6 +93,33 @@ export const PROPOSAL_STATUSES: Array<StatusSoT<PROPOSAL_STATUS>> = [
},
];
export const PROPOSAL_STAGES: Array<StatusSoT<PROPOSAL_STAGE>> = [
{
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<StatusSoT<PROPOSAL_ARBITER_STATUS>> = [
{
id: PROPOSAL_ARBITER_STATUS.MISSING,

View File

@ -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: