diff --git a/client/views/Exam.jsx b/client/views/Exam.jsx index a603661ae3a3c645b7780a34608bff957e29c934..f70b4a402a5693079c0f3fb4b832b4888a7e6677 100644 --- a/client/views/Exam.jsx +++ b/client/views/Exam.jsx @@ -42,7 +42,11 @@ class Exams extends React.Component { page: problem.page, name: problem.name, graded: problem.graded, - mc_options: problem.mc_options, + mc_options: problem.mc_options.map((option) => { + option.widget.x -= 7 + option.widget.y -= 21 + return option + }), isMCQ: problem.mc_options && problem.mc_options.length !== 0 // is the problem a mc question - used to display PanelMCQ } } @@ -319,7 +323,7 @@ class Exams extends React.Component { return { 'widget': { 'x': { - $set: data.x + i * 23 + $set: data.x + i * 24 }, 'y': { // each mc option needs to be positioned next to the previous option and should not overlap it @@ -359,8 +363,8 @@ class Exams extends React.Component { 'feedback_id': null, 'widget': { 'name': 'mc_option_' + labels[index], - 'x': xPos + 6, - 'y': yPos + 11, + 'x': xPos + 7, + 'y': yPos + 21, 'type': 'mcq_widget' } } @@ -373,6 +377,8 @@ class Exams extends React.Component { formData.append('label', data.label) api.put('mult-choice/', formData).then(result => { data.id = result.mult_choice_id + data.widget.x -= 7 + data.widget.y -= 21 this.createNewMCOWidget(problemWidget, data) this.generateAnswerBoxes(problemWidget, labels, index + 1, xPos + 24, yPos) }).catch(err => { diff --git a/client/views/ExamEditor.jsx b/client/views/ExamEditor.jsx index 11c69600d6b1344b950a69beecf3ab517014dfe9..086dfa916b3e0c940f8d61b64ca01dfb8bda26da 100644 --- a/client/views/ExamEditor.jsx +++ b/client/views/ExamEditor.jsx @@ -232,7 +232,7 @@ class ExamEditor extends React.Component { widget.problem.mc_options.forEach( (option, i) => { let newData = { - x: Math.round(data.x) + i * 23 + 7, + x: Math.round(data.x) + i * 24 + 7, y: Math.round(data.y) + 21 } this.updateWidgetPositionDB(option, newData)