Commit 0b55a65c authored by Christoph Thelen's avatar Christoph Thelen
Browse files

Highlight first new question based on sort order

This bug only appeared when the notification
box was used to enter the QuestionPanel.

The list of newly available questions is not sorted.
We need to use the sorted list loaded by the
QuestionPanel to properly highlight the first new
unanswered question.
parent baa4e47a
......@@ -39,7 +39,7 @@ Ext.define("ARSnova.controller.Questions", {
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.toolbar.backButton.show();
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.toolbar.setTitle(Messages.LECTURE_QUESTIONS);
if (options && options.renew) {
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.renew(options.id);
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.renew(options.ids);
}
ARSnova.app.mainTabPanel.tabPanel.animateActiveItem(ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel, 'slide');
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.addListener('deactivate', function (panel) {
......@@ -52,7 +52,7 @@ Ext.define("ARSnova.controller.Questions", {
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.toolbar.backButton.show();
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.toolbar.setTitle(Messages.PREPARATION_QUESTIONS);
if (options && options.renew) {
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.renew(options.id);
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.renew(options.ids);
}
ARSnova.app.mainTabPanel.tabPanel.animateActiveItem(ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel, 'slide');
ARSnova.app.mainTabPanel.tabPanel.userQuestionsPanel.addListener('deactivate', function (panel) {
......
......@@ -330,9 +330,9 @@ Ext.define('ARSnova.view.user.InClass', {
var callback = Ext.bind(function (answer) {
if (answer === 'yes') {
if (variant === 'lecture') {
ARSnova.app.getController('Questions').lectureIndex({renew: true, id: questionIds[0]});
ARSnova.app.getController('Questions').lectureIndex({renew: true, ids: questionIds});
} else {
ARSnova.app.getController('Questions').preparationIndex({renew: true, id: questionIds[0]});
ARSnova.app.getController('Questions').preparationIndex({renew: true, ids: questionIds});
}
}
}, this);
......
......@@ -77,7 +77,7 @@ Ext.define('ARSnova.view.user.QuestionPanel', {
if (this.alreadyRenewed) {
this.alreadyRenewed = false;
} else {
this.activeQuestionId = 0;
this.activeQuestionIds = [];
this.getUnansweredSkillQuestions();
}
},
......@@ -179,7 +179,10 @@ Ext.define('ARSnova.view.user.QuestionPanel', {
questionIds.forEach(function (questionId) {
userQuestionsPanel.addQuestion(questionsArr[questionId]);
if (questionId === self.activeQuestionId) {
// Select one of the new questions that have been added by the lecturer.
// The list of new questions is not sorted, so we select the first question that
// matches the ID of one of the new questions.
if (self.activeQuestionIds.indexOf(questionId) !== -1 && activeIndex === -1) {
activeIndex = index;
}
......@@ -381,10 +384,10 @@ Ext.define('ARSnova.view.user.QuestionPanel', {
}
},
renew: function (questionId) {
renew: function (questionIds) {
this.removeAll();
this.alreadyRenewed = true;
this.activeQuestionId = questionId;
this.activeQuestionIds = questionIds;
this.getUnansweredSkillQuestions();
},
......
Supports Markdown
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