Skip to content

Commit 28cd46a

Browse files
committed
feat: challenge with phase name open is considered open for registration
Signed-off-by: Rakib Ansary <[email protected]>
1 parent 2eb7834 commit 28cd46a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/services/ChallengeService.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ async function searchByLegacyId(currentUser, legacyId, page, perPage) {
132132
*/
133133
async function searchChallenges(currentUser, criteria) {
134134
// construct ES query
135-
console.log("Serach Challenges Query", JSON.stringify(criteria));
136135

137136
const page = criteria.page || 1;
138137
const perPage = criteria.perPage || 20;
@@ -374,9 +373,21 @@ async function searchChallenges(currentUser, criteria) {
374373
});
375374
}
376375
if (criteria.currentPhaseName) {
377-
boolQuery.push({
378-
match_phrase: { currentPhaseNames: criteria.currentPhaseName },
379-
});
376+
if (criteria.currentPhaseName === "Registration") {
377+
boolQuery.push({
378+
bool: {
379+
should: [
380+
{ match_phrase: { currentPhaseNames: "Registration" } },
381+
{ match_phrase: { currentPhaseNames: "Open" } },
382+
],
383+
minimum_should_match: 1,
384+
},
385+
});
386+
} else {
387+
boolQuery.push({
388+
match_phrase: { currentPhaseNames: criteria.currentPhaseName },
389+
});
390+
}
380391
}
381392
if (criteria.createdDateStart) {
382393
boolQuery.push({ range: { created: { gte: criteria.createdDateStart } } });

0 commit comments

Comments
 (0)