Commit cb0d527b authored by Joseph Weston's avatar Joseph Weston

fix off-by-one error when selecting exams

parent cb062bce
......@@ -231,11 +231,11 @@ class CheckStudents extends React.Component {
}
selectExam = (event) => {
var id = this.state.exam.list.findIndex(ex => ex.name === event.target.value);
const id = this.state.exam.list.findIndex(ex => ex.name === event.target.value);
this.setState({
exam: {
...this.state.exam,
id: id,
id: id + 1, // exam IDs are 1-based and the exam list is 0-based
name: event.target.value
}
}, this.loadSubmissions)
......@@ -472,4 +472,4 @@ class CheckStudents extends React.Component {
}
}
export default CheckStudents;
\ No newline at end of file
export default CheckStudents;
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