[FIX] survey: don't show leaderboards if no nickname question in survey
Before this commit, after each scored question, a intermediate leaderboard was shown, before going to the next question, even if no 'nickname' question was present in the survey. So that the leaderboards were display only 'anonymous' attendees, which is not really useful. Also, after last question, the final leaderbaord was not shown and the survey was closed immediatelly, which was not really coherent (show intermediate leaderboards but not the final one). After this commit, the leaderboards and the final one are shown only if a nickname question is present on the survey, so attendees can identify themselves and retreive their ranking on each leaderboards. Task ID: 2230980 X-original-commit: dd409de096c48f22476aff3f37526bc76c1cde12
This commit is contained in:
committed by
Thibault Delavallée
parent
cb67ff261f
commit
cbc8085761
@@ -255,14 +255,14 @@ publicWidget.registry.SurveySessionManage = publicWidget.Widget.extend({
|
||||
return 'userInputs';
|
||||
} else if (this.hasCorrectAnswers && ['question', 'userInputs'].includes(this.currentScreen)) {
|
||||
return 'results';
|
||||
} else if (['question', 'userInputs', 'results'].includes(this.currentScreen) &&
|
||||
this.isScoredQuestion) {
|
||||
return 'leaderboard';
|
||||
} else if (this.sessionShowLeaderboard && this.isLastQuestion) {
|
||||
return 'leaderboardFinal';
|
||||
} else {
|
||||
return 'nextQuestion';
|
||||
} else if (this.sessionShowLeaderboard) {
|
||||
if (['question', 'userInputs', 'results'].includes(this.currentScreen) && this.isScoredQuestion) {
|
||||
return 'leaderboard';
|
||||
} else if (this.isLastQuestion) {
|
||||
return 'leaderboardFinal';
|
||||
}
|
||||
}
|
||||
return 'nextQuestion';
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -327,8 +327,8 @@ publicWidget.registry.SurveySessionManage = publicWidget.Widget.extend({
|
||||
self.$el.fadeIn(self.fadeInOutTime, function () {
|
||||
self._startTimer();
|
||||
});
|
||||
} else {
|
||||
// Display last screen
|
||||
} else if (self.sessionShowLeaderboard) {
|
||||
// Display last screen if leaderboard activated
|
||||
self.isLastQuestion = true;
|
||||
self._setupLeaderboard().then(function () {
|
||||
self.$('.o_survey_session_leaderboard_title').text(_('Final Leaderboard'));
|
||||
@@ -336,6 +336,8 @@ publicWidget.registry.SurveySessionManage = publicWidget.Widget.extend({
|
||||
self.$('.o_survey_leaderboard_buttons').removeClass('d-none');
|
||||
self.leaderBoard.showLeaderboard(false);
|
||||
});
|
||||
} else {
|
||||
self.$('.o_survey_session_close').click();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user