Skip to content

Commit

Permalink
if this solves some user rights
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Nov 19, 2024
1 parent c7c580b commit 35d96d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import './FacultyMonitoringOverview.scss'
import { useDispatch, useSelector } from 'react-redux'
import CustomModal from 'Components/Generic/CustomModal'
import { getAllTempAnswersAction } from 'Utilities/redux/tempAnswersReducer'
import { getAnswersActionAll } from 'Utilities/redux/oldAnswersReducer'
import { facultyMonitoringQuestions as questions } from '@root/client/questionData/index'
import Square from 'Components/Generic/Square'
import ModalAnswer from './ModalAnswer'
Expand Down Expand Up @@ -53,7 +52,6 @@ const MonitoringOverview = ({ t, lang, faculties }) => {
useEffect(() => {
setRadioFilter('all')
dispatch(getAllTempAnswersAction())
dispatch(getAnswersActionAll())
}, [selectedLevel])

if (!answers) return <Loader active />
Expand Down Expand Up @@ -118,6 +116,8 @@ const MonitoringOverview = ({ t, lang, faculties }) => {
const getFacultySummarySectionData = (section, faculty) => {
const answer = answers.find(a => a.programme === faculty)

console.log(answer)

if (answer && answer.data.selectedQuestionIds) {
const questionIds = section.parts.map(part => part.id)

Expand Down
8 changes: 5 additions & 3 deletions server/controllers/answersController.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ const getAllTempUserHasAccessTo = async (req, res) => {
const finalCommitee = ['UNI', 'UNI_EN', 'UNI_SE']

// normal user route
const awaitYear = await whereDraftYear()
const anyAccess = hasAnyAccess(req.user)
const data = await db.tempAnswer.findAll({
where: {
year: await whereDraftYear(),
year: awaitYear,
[Op.or]: [
{ programme: Object.keys(req.user.access).concat(finalCommitee) },
anyAccess ? { form: [formKeys.YEARLY_ASSESSMENT, formKeys.EVALUATION_PROGRAMMES] } : {},
anyAccess
? { form: [formKeys.YEARLY_ASSESSMENT, formKeys.EVALUATION_PROGRAMMES, formKeys.FACULTY_MONITORING] }
: {},
],
},
})

return res.send(data)
} catch (error) {
logger.error(`Database error: ${error}`)
Expand Down

0 comments on commit 35d96d0

Please sign in to comment.