Commit d1cfdede authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Merge branch 'fix-grid-abstention' into '2.7'

Fix abstentions for grid questions

See merge request !88
parents 6c02f07b 5bc2e9e2
Pipeline #25266 passed with stages
in 1 minute and 11 seconds
...@@ -640,6 +640,9 @@ Ext.define('ARSnova.view.Question', { ...@@ -640,6 +640,9 @@ Ext.define('ARSnova.view.Question', {
saveGridQuestionHandler: function (grid) { saveGridQuestionHandler: function (grid) {
var me = this; var me = this;
if (this.grid.getChosenFields().length === 0) {
return;
}
Ext.Msg.confirm('', Messages.SUBMIT_ANSWER, function (button) { Ext.Msg.confirm('', Messages.SUBMIT_ANSWER, function (button) {
if (button !== 'yes') { if (button !== 'yes') {
return; return;
...@@ -664,7 +667,9 @@ Ext.define('ARSnova.view.Question', { ...@@ -664,7 +667,9 @@ Ext.define('ARSnova.view.Question', {
mcAbstentionHandler: function () { mcAbstentionHandler: function () {
var me = this; var me = this;
me.answerList.deselectAll(); if (me.answerList) {
me.answerList.deselectAll();
}
Ext.Msg.confirm('', Messages.SUBMIT_ANSWER, function (button) { Ext.Msg.confirm('', Messages.SUBMIT_ANSWER, function (button) {
if (button !== 'yes') { if (button !== 'yes') {
return; return;
...@@ -672,7 +677,7 @@ Ext.define('ARSnova.view.Question', { ...@@ -672,7 +677,7 @@ Ext.define('ARSnova.view.Question', {
me.getUserAnswer().then(function (answer) { me.getUserAnswer().then(function (answer) {
answer.set('abstention', true); answer.set('abstention', true);
me.answerList.deselectAll(); answer.set('answerText', null);
me.saveAnswer(answer); me.saveAnswer(answer);
}); });
......
...@@ -345,7 +345,7 @@ Ext.define('ARSnova.view.user.QuestionPanel', { ...@@ -345,7 +345,7 @@ Ext.define('ARSnova.view.user.QuestionPanel', {
return; return;
} }
if (questionObj.isAbstentionAnswer && "mc" !== questionObj.questionType) { if (questionObj.isAbstentionAnswer && ["mc", "grid"].indexOf(questionObj.questionType) === -1) {
questionPanel.selectAbstentionAnswer(); questionPanel.selectAbstentionAnswer();
questionPanel.disableQuestion(); questionPanel.disableQuestion();
return; return;
......
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