Skip to content

Commit

Permalink
fix: setting setviewOnly true
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Dec 2, 2024
1 parent cc952dd commit 3f2d56a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Answer from './Answer'
import QuestionPicker from './QuestionPicker'
import FacultyDegreeDropdown from '../FacultyDegreeDropdown'
import './FacultyTrackingView.scss'
import * as deadline from '@models/deadline'

const FacultyTrackingView = ({ faculty }) => {
const { t } = useTranslation()
Expand All @@ -31,6 +32,8 @@ const FacultyTrackingView = ({ faculty }) => {
const [activeAccordions, setActiveAccordions] = useState({})
const viewOnly = useSelector(({ form }) => form.viewOnly)
const selectedLevel = useSelector(({ filters }) => filters.level)
const { nextDeadline } = useSelector(state => state.deadlines)
const formDeadline = nextDeadline ? nextDeadline.find(d => d.form === form) : null

const hasReadRights = user.access[faculty]?.read || user.specialGroup?.evaluationFaculty || isAdmin(user)
const hasWriteRights = (user.access[faculty]?.write && user.specialGroup?.evaluationFaculty) || isAdmin(user)
Expand All @@ -44,7 +47,7 @@ const FacultyTrackingView = ({ faculty }) => {
if (!faculty || !form || !hasReadRights) return
dispatch(getTempAnswersByForm(form))

if (!hasWriteRights) {
if (!hasWriteRights || !formDeadline) {
dispatch(wsJoinRoom(faculty, form))
dispatch(setViewOnly(true))
if (currentRoom) {
Expand Down

0 comments on commit 3f2d56a

Please sign in to comment.