Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
perf(stage): count archived cards
Browse files Browse the repository at this point in the history
close #778
  • Loading branch information
munkhorgil committed May 12, 2020
1 parent 3bb59fa commit 3700afa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/data/resolvers/queries/boardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ export const generateCommonFilters = async (currentUserId: string, args: any) =>
labelIds,
priority,
userIds,
filterArchive = true,
} = args;

const isListEmpty = value => {
return value.length === 1 && value[0].length === 0;
};

const filter: any = { status: { $ne: BOARD_STATUSES.ARCHIVED } };
const filter: any = {};

if (filterArchive) {
filter.status = { $ne: BOARD_STATUSES.ARCHIVED };
}

let filterIds: string[] = [];

Expand Down
7 changes: 4 additions & 3 deletions src/data/resolvers/stages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
case BOARD_TYPES.DEAL: {
const filter = await generateDealCommonFilters(
user._id,
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId },
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId, filterArchive: false },
args.extraParams,
);

Expand All @@ -65,7 +65,7 @@ export default {
case BOARD_TYPES.TICKET: {
const filter = await generateTicketCommonFilters(
user._id,
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId },
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId, filterArchive: false },
args.extraParams,
);

Expand All @@ -76,14 +76,15 @@ export default {
...args,
stageId: stage._id,
pipelineId: stage.pipelineId,
filterArchive: false,
});

return Tasks.find(filter).countDocuments();
}
case BOARD_TYPES.GROWTH_HACK: {
const filter = await generateGrowthHackCommonFilters(
user._id,
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId },
{ ...args, stageId: stage._id, pipelineId: stage.pipelineId, filterArchive: false },
args.extraParams,
);

Expand Down

0 comments on commit 3700afa

Please sign in to comment.