Commit b27a6297 authored by Hidde Leistra's avatar Hidde Leistra

Fix feedback options not updating in exam view

This is a sub-optimal fix, could be adjusted later on.
parent 7585d024
......@@ -19,6 +19,8 @@ class Exams extends React.Component {
state = {
examID: null,
page: 0,
editActive: false,
feedbackToEdit: null,
numPages: null,
selectedWidgetId: null,
changedWidgetId: null,
......@@ -54,8 +56,11 @@ class Exams extends React.Component {
previewing: false
}
}
return null
// This is a rough update for when feedback is edited.
newProps.exam.problems.forEach(problem => {
prevState.widgets[problem.widget.id].problem.feedback = problem.feedback
})
return prevState
}
componentDidUpdate = (prevProps, prevState) => {
......@@ -286,6 +291,8 @@ class Exams extends React.Component {
PanelEdit = (props) => {
const selectedWidgetId = this.state.selectedWidgetId
let selectedWidget = selectedWidgetId && this.state.widgets[selectedWidgetId]
let problem = selectedWidget && selectedWidget.problem
return (
<nav className='panel'>
......@@ -315,15 +322,12 @@ class Exams extends React.Component {
}} />
{this.state.editActive
? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
? <EditPanel problemID={problem.id} feedback={this.state.feedbackToEdit}
goBack={this.backToFeedback} />
: <FeedbackPanel examID={this.props.examID} problem={props.problem}
: <FeedbackPanel examID={this.props.examID} problem={problem}
editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
grading={false} updateSubmission={() => {
this.props.updateSubmission(this.state.sIndex)
}
} />}
{console.log(props.problem)}
grading={false}
/>}
</div>
</React.Fragment>
)}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment