Commit a073e348 authored by Adrià Labay's avatar Adrià Labay
Browse files

remove option to convert to unstructured

parent 9dc12027
......@@ -65,8 +65,7 @@ class ExamZesje extends React.Component {
previewing: false,
deletingWidget: false,
deletingMCWidget: false,
showPanelMCQ: false,
convertToUnstructured: false
showPanelMCQ: false
}
static getDerivedStateFromProps = (newProps, prevState) => {
......@@ -613,11 +612,6 @@ class ExamZesje extends React.Component {
examID={this.props.exam.id}
gradeAnonymous={this.props.exam.gradeAnonymous}
onChange={(anonymous) => this.props.updateExam(null)} />}
<button
className='button is-info is-outlined is-fullwidth'
onClick={() => this.setState({convertToUnstructured: true})}>
Convert to Unstructured
</button>
</React.Fragment>
)
}
......@@ -910,27 +904,6 @@ class ExamZesje extends React.Component {
this.deleteMCOs(this.state.selectedWidgetId, 0)
}}
/>
<ConfirmationModal
active={this.state.convertToUnstructured}
color='is-danger'
headerText='Are you sure you want to convert this exam to unstructured?'
contentText={`This option should only be used for exams meant to be solved by uploads from students.
The option to convert exams will be removed in the future, please create unstructured exams directly instead.`}
confirmText='Convert'
onCancel={() => this.setState({convertToUnstructured: false})}
onConfirm={() => {
api.put(`exams/${this.state.examID}`, {convertToUnstructured: true})
.then(resp => {
this.props.updateExam(this.state.examID)
this.setState({convertToUnstructured: false})
})
.catch(err => {
console.log(err)
this.setState({convertToUnstructured: false})
Notification.danger('Could not convert to unstructured exam')
})
}}
/>
</React.Fragment>
}
}
......
......@@ -304,7 +304,6 @@ class Exams(Resource):
put_parser = reqparse.RequestParser()
put_parser.add_argument('finalized', type=bool, required=False)
put_parser.add_argument('grade_anonymous', type=bool, required=False)
put_parser.add_argument('convertToUnstructured', type=bool, required=False)
def put(self, exam_id):
if (exam := Exam.query.get(exam_id)) is None:
......@@ -326,13 +325,6 @@ class Exams(Resource):
else:
return dict(status=403, message='Exam can not be unfinalized'), 403
if args['convertToUnstructured'] is not None and exam.layout == ExamLayout.zesje:
exam.finalized = True
exam.layout = ExamLayout.unstructured
db.session.commit()
return dict(status=200, message="ok"), 200
if args['grade_anonymous'] is not None:
exam.grade_anonymous = args['grade_anonymous']
db.session.commit()
......
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