Skip to content

Commit

Permalink
return proper projects
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadPCh committed Dec 9, 2024
1 parent e89c1ea commit 92f15c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/repositories/projectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type FilterProjectQueryInputParams = {
qfRoundId?: number;
activeQfRoundId?: number;
qfRoundSlug?: string;
includeUnlisted?: boolean;
};
export const filterProjectsQuery = (params: FilterProjectQueryInputParams) => {
const {
Expand All @@ -97,6 +98,7 @@ export const filterProjectsQuery = (params: FilterProjectQueryInputParams) => {
qfRoundId,
qfRoundSlug,
activeQfRoundId,
includeUnlisted,
} = params;

let query = Project.createQueryBuilder('project')
Expand All @@ -122,11 +124,16 @@ export const filterProjectsQuery = (params: FilterProjectQueryInputParams) => {
'projectPower.totalPower',
'projectPower.powerRank',
'projectPower.round',
])
.where(
]);

if (includeUnlisted) {
query = query.where(`project.statusId = ${ProjStatus.active}`);
} else {
query = query.where(
`project.statusId = ${ProjStatus.active} AND project.reviewStatus = :reviewStatus`,
{ reviewStatus: ReviewStatus.Listed },
);
}

const isFilterByQF =
!!filters?.find(f => f === FilterField.ActiveQfRound) && activeQfRoundId;
Expand Down Expand Up @@ -255,7 +262,6 @@ export const filterProjectsQuery = (params: FilterProjectQueryInputParams) => {
break;
case SortingField.BestMatch:
break;

default:
query
.addOrderBy('projectInstantPower.totalPower', OrderDirection.DESC)
Expand Down

0 comments on commit 92f15c9

Please sign in to comment.