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 ( 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, },