Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6a3684b
Disabled instrospection
wickathou Nov 10, 2023
8c02b24
Added conditional allow redirect logic after submission is completed
wickathou Nov 11, 2023
6f08a2c
Added status to project tables
wickathou Nov 11, 2023
8fea27d
Fix typos in error messages
JoaRiski Nov 12, 2023
8b3f962
Removed previous modals used to create custom sections and questions …
wickathou Feb 16, 2024
5d7f2ea
Added helper text to EditableText to avoid blank invisible fields
wickathou Feb 20, 2024
34b51ca
Create new modal for displaying preview of Event Page Customization
davidamebley Feb 23, 2024
3fae76a
Add state for controlling preview modal open state
davidamebley Feb 23, 2024
2439bb3
Add initial code for the structure of the EventPageCustomizationPrevi…
davidamebley Feb 23, 2024
ed6f2ce
Modify PreviewOpen state variable name to correctly reflect it's bool…
davidamebley Feb 24, 2024
07f30b6
Modify EventPageCustomizationPreviewModal to arrow function
davidamebley Feb 24, 2024
a8a76a9
Import and add EventPageCustomizationPreviewModal to preview event pa…
davidamebley Feb 24, 2024
a8dc883
Move EventPageCustomizationPreviewModal to _events directory
davidamebley Feb 24, 2024
40f798f
Move EventPageCustomizationPreviewModal to _events directory
davidamebley Feb 24, 2024
16f2314
Populate EventPagePreview component with default code from _events/sl…
davidamebley Feb 24, 2024
d85d203
Replace event slug with new EventPagePreview component as a prop for …
davidamebley Feb 24, 2024
c28dc82
Remove EventPagePreview prop from EventPageCustomizationPreviewModal …
davidamebley Feb 24, 2024
012534c
Create a custom useQuery hook to allow to read and update query param…
davidamebley Feb 25, 2024
28c066e
Conditionally render globalnavbar and footer for event detail preview
davidamebley Feb 25, 2024
d0db508
Reintroduce the use of a prop and iframe for the content of the even…
davidamebley Feb 25, 2024
dd281a4
Reintroduce the prop for the
davidamebley Feb 25, 2024
743d0d3
Undo changes made in App.js as they're no mode needed
davidamebley Feb 25, 2024
6f78285
Remove unused imports
davidamebley Feb 25, 2024
26e2412
Remove unused imports
davidamebley Feb 25, 2024
e5c6c54
Add isPreview prop to component and conditionally render its back bu…
davidamebley Feb 25, 2024
fc6d01e
Add isPreview prop to component and conditionally disable its button…
davidamebley Feb 25, 2024
01e4a6a
Optionally pass prop to component and its and children components
davidamebley Feb 25, 2024
93bb5e4
Pass state prop to component inside 's Route component
davidamebley Feb 25, 2024
da6d498
Delete component file as it is no more needed
davidamebley Feb 25, 2024
4cd4093
Adjust the size of the preview modal and the position and size of it'…
davidamebley Feb 25, 2024
af2d5b8
Reorganized project controller and modified getFinalists to be an asy…
wickathou Apr 3, 2024
0c8f68d
Fixed flattenObject function in organiser/projects pages to enable ex…
wickathou Apr 3, 2024
8ea3cdf
Reduced the amount of OrganizerActions being executed on the root rou…
wickathou Apr 9, 2024
b20ed49
Removed fira code font
wickathou Apr 10, 2024
ba21b0c
Bump loader-utils and react-scripts in /frontend
dependabot[bot] Apr 10, 2024
a9f3907
Bump qs from 6.5.2 to 6.5.3
dependabot[bot] Apr 10, 2024
74f226d
Merge pull request #579 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 10, 2024
d9ee9db
Merge pull request #582 from hackjunction/dependabot/npm_and_yarn/qs-…
wickathou Apr 10, 2024
a7b54a2
Bump json5 from 1.0.1 to 1.0.2
dependabot[bot] Apr 10, 2024
2d70d47
Bump cookiejar from 2.1.2 to 2.1.4
dependabot[bot] Apr 10, 2024
c6558a0
Bump jose from 4.14.4 to 4.15.5
dependabot[bot] Apr 10, 2024
d88fda1
Bump follow-redirects from 1.14.1 to 1.15.6
dependabot[bot] Apr 10, 2024
021b9e8
Bump follow-redirects from 1.15.2 to 1.15.6 in /frontend
dependabot[bot] Apr 10, 2024
cbc5e4f
Bump follow-redirects from 1.15.2 to 1.15.6 in /backend
dependabot[bot] Apr 10, 2024
badc0ac
Merge pull request #589 from hackjunction/dependabot/npm_and_yarn/jso…
wickathou Apr 10, 2024
6c07068
Merge pull request #593 from hackjunction/dependabot/npm_and_yarn/coo…
wickathou Apr 10, 2024
23d0a67
Merge pull request #777 from hackjunction/dependabot/npm_and_yarn/jos…
wickathou Apr 10, 2024
51e704a
Merge pull request #781 from hackjunction/dependabot/npm_and_yarn/fol…
wickathou Apr 10, 2024
f3338da
Merge pull request #782 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 10, 2024
faef506
Merge pull request #783 from hackjunction/dependabot/npm_and_yarn/bac…
wickathou Apr 10, 2024
8f53557
Bump shell-quote from 1.7.2 to 1.8.1
dependabot[bot] Apr 11, 2024
503140c
Bump eslint-plugin-import from 2.20.2 to 2.29.1 in /shared
dependabot[bot] Apr 11, 2024
b985f75
Bump graphql from 15.0.0 to 16.8.1 in /shared
dependabot[bot] Apr 11, 2024
7914757
Bump eslint-plugin-prettier from 3.1.3 to 3.4.1 in /shared
dependabot[bot] Apr 11, 2024
743a0ed
Bump axios and auth0-deploy-cli
dependabot[bot] Apr 11, 2024
9dad6f2
Bump d3-color and recharts in /frontend
dependabot[bot] Apr 11, 2024
42c22db
Bump express from 4.18.2 to 4.19.2 in /backend
dependabot[bot] Apr 11, 2024
26a18ae
Bump notistack from 0.9.17 to 3.0.1 in /frontend
dependabot[bot] Apr 11, 2024
f474f7f
Merge pull request #794 from hackjunction/dependabot/npm_and_yarn/bac…
wickathou Apr 11, 2024
d03e0fb
Bump formik from 2.4.3 to 2.4.5 in /frontend
dependabot[bot] Apr 11, 2024
81b0455
Merge pull request #797 from hackjunction/dependabot/npm_and_yarn/she…
wickathou Apr 11, 2024
6af5d80
Merge pull request #798 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 11, 2024
3269391
Merge pull request #799 from hackjunction/dependabot/npm_and_yarn/sha…
wickathou Apr 11, 2024
6f1e058
Bump jwks-rsa from 1.12.3 to 3.1.0 in /backend
dependabot[bot] Apr 11, 2024
0870020
Merge pull request #800 from hackjunction/dependabot/npm_and_yarn/sha…
wickathou Apr 11, 2024
6c35105
Merge pull request #801 from hackjunction/dependabot/npm_and_yarn/sha…
wickathou Apr 11, 2024
a7ecb81
Bump mongoose from 5.9.16 to 8.3.1 in /shared
dependabot[bot] Apr 11, 2024
93366c9
Merge pull request #811 from hackjunction/STAG
wickathou Apr 11, 2024
a4b6965
Merge pull request #802 from hackjunction/dependabot/npm_and_yarn/sha…
wickathou Apr 11, 2024
fe88923
Merge pull request #803 from hackjunction/dependabot/npm_and_yarn/bac…
wickathou Apr 11, 2024
9fba120
Merge pull request #804 from hackjunction/dependabot/npm_and_yarn/mul…
wickathou Apr 11, 2024
649823c
Merge pull request #805 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 11, 2024
9a1bf26
Merge pull request #812 from hackjunction/dependabot/STAG
wickathou Apr 11, 2024
ec5a855
Bump moment from 2.29.4 to 2.30.1 in /frontend
dependabot[bot] Apr 11, 2024
a719c5a
Merge pull request #808 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 11, 2024
7d066a8
Merge pull request #810 from hackjunction/dependabot/npm_and_yarn/fro…
wickathou Apr 11, 2024
4158bd4
Merge pull request #741 from JoaRiski/errors-message-fix
wickathou Apr 11, 2024
a037f85
Merge pull request #762 from wickathou/bugfix/custom-questions-empty-…
wickathou Apr 11, 2024
479b28f
Merge pull request #733 from wickathou/bugfix/bottom-bar-bug-submissions
wickathou Apr 11, 2024
eb12404
Merge branch 'STAG' into micro-feature/added-sort-to-organiser-projec…
wickathou Apr 11, 2024
39d956a
Merge pull request #738 from wickathou/micro-feature/added-sort-to-or…
wickathou Apr 11, 2024
707b2a7
Fixed conflicts
wickathou Apr 11, 2024
9caf879
Removed unused packages and commented code
wickathou Apr 11, 2024
384d8e7
Removed non-working props
wickathou Apr 11, 2024
aa9c823
removed unnused package
wickathou Apr 11, 2024
59ba5c4
Merge pull request #813 from wickathou/update/pre-STAG
wickathou Apr 11, 2024
a16b615
Merge pull request #795 from wickathou/fix/improving-finalist-voting-…
wickathou Apr 11, 2024
fdebfb5
Merge pull request #796 from wickathou/fix/dashboard-performance-orga…
wickathou Apr 11, 2024
f7f4f8f
Bump @apollo/client from 3.8.1 to 3.9.11 in /frontend
dependabot[bot] Apr 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions backend/modules/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ module.exports = app => {
const server = new ApolloServer({
schema,
playground: false,
// TODO make instrospection false in production
introspection: true,
introspection: false,
context: ({ req, res }) => ({
req,
res,
Expand Down
10 changes: 7 additions & 3 deletions backend/modules/project/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ controller.exportProjects = async projectIds => {

return exportData
}
controller.getFinalists = event => {
return Project.find({ _id: { $in: event.finalists } })
controller.getFinalists = async event => {
const finalistProjects = await Project.find({
_id: { $in: event.finalists },
})
return finalistProjects
}
module.exports = controller

controller.getDataForPartnerReviewing = async (event, user) => {
const data = {}
Expand Down Expand Up @@ -261,3 +263,5 @@ controller.getDataForPartnerReviewing = async (event, user) => {
}
return data
}

module.exports = controller
7 changes: 1 addition & 6 deletions backend/modules/project/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const AchievementSchema = require('../../common/schemas/Achievement')
const GavelController = require('../reviewing/gavel/controller')
const WebhookService = require('../../common/services/webhook')
const CustomAnswer = require('@hackjunction/shared/schemas/CustomAnswer')
const ProjectDefaultFields = require('@hackjunction/shared/constants/project-default-fields')
// const ProjectDefaultFields = require('@hackjunction/shared/constants/project-default-fields')
// const AnswersSchema = require('@hackjunction/shared/schemas/Answers')

const ProjectSchema = new mongoose.Schema({
Expand Down Expand Up @@ -70,11 +70,6 @@ const ProjectSchema = new mongoose.Schema({
submissionFormAnswers: {
type: [CustomAnswer.mongoose],
},
// TODO default fields
// enabledFields: {
// type: [String],
// default: ProjectDefaultFields,
// },
})

ProjectSchema.set('timestamps', true)
Expand Down
2 changes: 1 addition & 1 deletion backend/modules/reviewing/gavel/Annotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ GavelAnnotatorSchema.methods.canVote = async function () {

if (!EventHelpers.isVotingOpen(event, moment)) {
return Promise.reject(
new ForbiddenError('Cannot subm,it votes while voting is not open'),
new ForbiddenError('Cannot submit votes while voting is not open'),
)
}

Expand Down
51 changes: 49 additions & 2 deletions backend/modules/winner-votes/controller.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,56 @@
const _ = require('lodash')
const WinnerVote = require('./model')
const projectController = require('../project/controller')
const tokenVotingController = require('../voting-token/controller')

const controller = {}

controller.getFinalistProjectsWithAllVotes = async event => {
const finalistProjects = await projectController.getFinalists(event)
const finalistProjectsWithVotes = finalistProjects.map(project => {
const projectObject = project.toObject()
projectObject.votingData = {
totalVotes: 0,
userVotes: 0,
tokenVotes: 0,
}
return projectObject
})
const userVotes = await controller.getVotesForEvent(event)
const tokenVotes = await tokenVotingController.getVotesByProject(event._id)
if (userVotes) {
userVotes.map(v => {
const projectWithVotes = _.find(
finalistProjectsWithVotes,
project => project._id.toString() === v.project,
)
if (projectWithVotes) {
projectWithVotes.votingData.userVotes = v.votes
}
})
}
if (tokenVotes) {
tokenVotes.map(v => {
const projectWithVotes = _.find(
finalistProjectsWithVotes,
project => project._id.toString() === v.project,
)
if (projectWithVotes) {
projectWithVotes.votingData.tokenVotes = v.votes
}
})
}
finalistProjectsWithVotes.forEach(project => {
project.votingData.totalVotes =
project.votingData.userVotes + project.votingData.tokenVotes
})
const sortedProjects = _.sortBy(
finalistProjectsWithVotes,
n => -1 * n.votingData.totalVotes,
)
return sortedProjects
}

controller.getVotesForEvent = async event => {
const votes = await WinnerVote.find({ event: event._id }).lean()
const grouped = _.groupBy(votes, 'project')
Expand All @@ -14,8 +62,7 @@ controller.getVotesForEvent = async event => {
})
return result
}, [])
const sorted = _.sortBy(results, n => -1 * n.votes)
return sorted
return results
}

module.exports = controller
106 changes: 74 additions & 32 deletions backend/modules/winner-votes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,97 @@ const {
isEventOrganiser,
} = require('../../common/middleware/events')

const votingController = require('./controller')

const getProjectsWithVotesForEvent = asyncHandler(async (req, res) => {
const finalistProjectsWithAllVotes =
await votingController.getFinalistProjectsWithAllVotes(req.event)
return res.status(200).json(finalistProjectsWithAllVotes)
})

const getVote = asyncHandler(async (req, res) => {
const vote = await WinnerVote.findOne({
event: req.event._id,
user: req.user.sub,
})

return res.status(200).json(vote)
})

const submitVote = asyncHandler(async (req, res) => {
const vote = await WinnerVote.findOne({
event: req.event._id,
user: req.user.sub,
})
if (vote) {
vote.project = req.body.projectId
const result = await vote.save()
return res.status(200).json(result)
}
const newVote = new WinnerVote({
event: req.event._id,
user: req.user.sub,
project: req.body.projectId,
})
const result = await newVote.save()
return res.status(200).json(result)
})

router
.route('/:slug')
.get(
hasToken,
hasRegisteredToEvent,
asyncHandler(async (req, res) => {
const vote = await WinnerVote.findOne({
event: req.event._id,
user: req.user.sub,
})
getVote,
// asyncHandler(async (req, res) => {
// const vote = await WinnerVote.findOne({
// event: req.event._id,
// user: req.user.sub,
// })

return res.status(200).json(vote)
}),
// return res.status(200).json(vote)
// }),
)
.post(
hasToken,
hasRegisteredToEvent,
asyncHandler(async (req, res) => {
const vote = await WinnerVote.findOne({
event: req.event._id,
user: req.user.sub,
})
if (vote) {
vote.project = req.body.projectId
const result = await vote.save()
return res.status(200).json(result)
}
const newVote = new WinnerVote({
event: req.event._id,
user: req.user.sub,
project: req.body.projectId,
})
const result = await newVote.save()
return res.status(200).json(result)
}),
submitVote,
// asyncHandler(async (req, res) => {
// const vote = await WinnerVote.findOne({
// event: req.event._id,
// user: req.user.sub,
// })
// if (vote) {
// vote.project = req.body.projectId
// const result = await vote.save()
// return res.status(200).json(result)
// }
// const newVote = new WinnerVote({
// event: req.event._id,
// user: req.user.sub,
// project: req.body.projectId,
// })
// const result = await newVote.save()
// return res.status(200).json(result)
// }),
)

router.route('/:slug/results').get(
hasToken,
isEventOrganiser,
asyncHandler(async (req, res) => {
const votes = await WinnerVote.find({
event: req.event._id,
})
getProjectsWithVotesForEvent,
// asyncHandler(async (req, res) => {
// const votes = await WinnerVote.find({
// event: req.event._id,
// })

const grouped = _.groupBy(votes, 'project')
// const grouped = _.groupBy(votes, 'project')
// console.log('Grouped votes:', grouped)
// getProjectsWithVotesForEvent(req, res)

return res.status(200).json(grouped)
}),
// return res.status(200).json(grouped)
// }
)
// )

module.exports = router
Loading