From aa382c4b2ad74c9fd7a05c09d9b75e6e497dfe56 Mon Sep 17 00:00:00 2001 From: wickathou Date: Thu, 30 May 2024 16:18:09 +0300 Subject: [PATCH 1/2] Removed repeated fields from the challenge schema --- shared/schemas/Challenge.js | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/shared/schemas/Challenge.js b/shared/schemas/Challenge.js index 397607fb1..7a229c152 100644 --- a/shared/schemas/Challenge.js +++ b/shared/schemas/Challenge.js @@ -46,30 +46,6 @@ const ChallengeSchema = new mongoose.Schema({ companyInfo: { type: String, }, - title: { - type: String, - }, - subtitle: { - type: String, - }, - description: { - type: String, - }, - insights: { - type: String, - }, - resources: { - type: String, - }, - prizes: { - type: String, - }, - criteria: { - type: String, - }, - companyInfo: { - type: String, - }, logo: CloudinaryImageSchema.mongoose, }) @@ -97,15 +73,6 @@ const ChallengeType = new GraphQLObjectType({ description: { type: GraphQLString, }, - title: { - type: GraphQLString, - }, - subtitle: { - type: GraphQLString, - }, - description: { - type: GraphQLString, - }, insights: { type: GraphQLString, }, From 6eecd1137aad22d2e624a180e01e14c0891a08b0 Mon Sep 17 00:00:00 2001 From: wickathou Date: Thu, 30 May 2024 17:00:49 +0300 Subject: [PATCH 2/2] Fixed issue with redux store values for challenges being modified by the /teams page with the teamCount property --- .../organiser/participants/teams/index.js | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/frontend/src/pages/_dashboard/renderDashboard/organiser/participants/teams/index.js b/frontend/src/pages/_dashboard/renderDashboard/organiser/participants/teams/index.js index 9f0e7c53a..b3abe3c32 100644 --- a/frontend/src/pages/_dashboard/renderDashboard/organiser/participants/teams/index.js +++ b/frontend/src/pages/_dashboard/renderDashboard/organiser/participants/teams/index.js @@ -14,23 +14,19 @@ export default () => { const registrationsLoading = useSelector( OrganiserSelectors.registrationsLoading, ) + const challengeList = [] const teamsLoading = useSelector(OrganiserSelectors.teamsLoading) - const challengeList = event?.challenges || [] - - if (challengeList.length > 0) { - challengeList.forEach(challenge => { - challenge.teamCount = 0 - }) - } - - if (teams.length > 0) { - teams.map(team => { - challengeList.find(challenge => { - if (challenge._id === team.challenge) { - challenge.teamCount += 1 - } + if (event?.challenges && event?.challenges.length > 0) { + challengeList.push(...event?.challenges.map(challenge => ({ ...challenge, teamCount: 0 }))) + if (teams.length > 0) { + teams.map(team => { + challengeList.find(challenge => { + if (challenge._id === team.challenge) { + challenge.teamCount += 1 + } + }) }) - }) + } } return (