Skip to content

Commit

Permalink
trying if this fixes things
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Jan 8, 2025
1 parent e0f44f2 commit c6d1a0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions client/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ export const answersByYear = ({ year, tempAnswers, oldAnswers, draftYear, deadli
return tempAnswers?.data.filter(a => a.year === year).filter(a => !form || a.form === form)
}

if (form === formKeys.FACULTY_MONITORING) {
console.log(tempAnswers.data.filter(a => a.year === year).filter(a => !form || a.form === form))
return tempAnswers.data.filter(a => a.year === year).filter(a => !form || a.form === form)
}

// if viewing past years' answers
if (draftYear !== year && oldAnswers && oldAnswers.data) {
return oldAnswers.data.filter(a => a.year === year).filter(a => !form || a.form === form)
Expand Down
9 changes: 5 additions & 4 deletions server/controllers/answersController.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const getAll = async (_, res) => {
}
}

// getting all temp answers user has access to from every year
const getAllTempUserHasAccessTo = async (req, res) => {
try {
// admin route
if (isAdmin(req.user) || isSuperAdmin(req.user)) {
const data = await db.tempAnswer.findAll({
where: {
year: await whereDraftYear(),
},
// where: {
// year: await whereDraftYear(),
// },
})
return res.send(data)
}
Expand All @@ -42,7 +43,7 @@ const getAllTempUserHasAccessTo = async (req, res) => {
const anyAccess = hasAnyAccess(req.user)
const data = await db.tempAnswer.findAll({
where: {
year: awaitYear,
// year: awaitYear,
[Op.or]: [
{ programme: Object.keys(req.user.access).concat(finalCommitee) },
anyAccess
Expand Down

0 comments on commit c6d1a0a

Please sign in to comment.