Skip to content
Snippets Groups Projects

Toggling pregrading and Identifying blank solutions

Open Ghost User requested to merge feature/toggle-pregrading into develop
Compare and Show latest version
17 files
+ 354
350
Compare changes
  • Side-by-side
  • Inline
Files
17
+ 43
1
@@ -47,6 +47,7 @@ class Exams extends React.Component {
@@ -47,6 +47,7 @@ class Exams extends React.Component {
page: problem.page,
page: problem.page,
name: problem.name,
name: problem.name,
graded: problem.graded,
graded: problem.graded,
 
grading_policy: problem.grading_policy,
feedback: problem.feedback || [],
feedback: problem.feedback || [],
mc_options: problem.mc_options.map((option) => {
mc_options: problem.mc_options.map((option) => {
// the database stores the positions of the checkboxes but the front end uses the top-left position
// the database stores the positions of the checkboxes but the front end uses the top-left position
@@ -195,13 +196,40 @@ class Exams extends React.Component {
@@ -195,13 +196,40 @@ class Exams extends React.Component {
const problem = changedWidget.problem
const problem = changedWidget.problem
if (!problem) return
if (!problem) return
api.put('problems/' + problem.id + '/name', { name: problem.name })
api.put('problems/' + problem.id, { name: problem.name })
.catch(e => Notification.error('Could not save new problem name: ' + e))
.catch(e => Notification.error('Could not save new problem name: ' + e))
.then(this.setState({
.then(this.setState({
changedWidgetId: null
changedWidgetId: null
}))
}))
}
}
 
onChangeAutoApproveType (e) {
 
const selectedWidgetId = this.state.selectedWidgetId
 
if (!selectedWidgetId) return
 
 
const selectedWidget = this.state.widgets[selectedWidgetId]
 
if (!selectedWidget) return
 
 
const problem = selectedWidget.problem
 
if (!problem) return
 
 
const newPolicy = e.target.value
 
 
api.put('problems/' + problem.id, { grading_policy: newPolicy })
 
.catch(e => Notification.error('Could not change grading policy: ' + e))
 
.then(this.setState(prevState => ({
 
widgets: update(prevState.widgets, {
 
[selectedWidgetId]: {
 
problem: {
 
grading_policy: {
 
$set: newPolicy
 
}
 
}
 
}
 
})
 
})))
 
}
 
createNewWidget = (widgetData) => {
createNewWidget = (widgetData) => {
this.setState((prevState) => {
this.setState((prevState) => {
return {
return {
@@ -738,6 +766,20 @@ class Exams extends React.Component {
@@ -738,6 +766,20 @@ class Exams extends React.Component {
}
}
</React.Fragment>
</React.Fragment>
)}
)}
 
{props.problem &&
 
<React.Fragment>
 
<div className='panel-block mcq-block'>
 
<b>Auto-approve</b>
 
<div className='select is-hovered is-fullwidth'>
 
<select value={props.problem.grading_policy} onChange={this.onChangeAutoApproveType.bind(this)}>
 
<option value='0'>Nothing</option>
 
<option value='1'>Blanks</option>
 
{props.problem.mc_options.length !== 0 && <option value='2'>One answer/blanks</option>}
 
</select>
 
</div>
 
</div>
 
</React.Fragment>
 
}
<div className='panel-block'>
<div className='panel-block'>
<button
<button
disabled={props.disabledDelete}
disabled={props.disabledDelete}
Loading