-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] website_slides: allow multiple correct answers
Purpose ======= Currently the user interface let you specify several correct answers per quiz question. But when you save the course, you get a notification error. As those are simple quizzes, it might be interesting to simply allow multiple answers. Specifications ============== Allow questions with multiple correct answers. Back-end views: improve feedback when user forget to set at least one correct answer and one incorrect answer per question. Task-3366803 closes odoo#127065 Signed-off-by: Stéphane Debauche (std) <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
from odoo import Command | ||
|
||
from odoo.addons.website_slides.tests import common as slides_common | ||
from odoo.tests.common import users | ||
|
||
class TestSlideQuestionManagement(slides_common.SlidesCase): | ||
|
||
@users('user_officer') | ||
def test_compute_answers_validation_error(self): | ||
channel = self.env['slide.channel'].create({ | ||
'name': 'Test compute answers channel', | ||
'slide_ids': [Command.create({ | ||
'name': "Test compute answers validation error slide", | ||
'slide_category': 'quiz', | ||
'question_ids': [Command.create({ | ||
'question': 'Will test compute answers validation error pass?', | ||
'answer_ids': [ | ||
Command.create({ | ||
'text_value': 'An incorrect answer', | ||
}), | ||
Command.create({ | ||
'is_correct': True, | ||
'text_value': 'A correct answer', | ||
}) | ||
] | ||
})] | ||
})] | ||
}) | ||
|
||
question = channel.slide_ids[0].question_ids[0] | ||
self.assertFalse(question.answers_validation_error) | ||
|
||
for val in (False, True): | ||
question.answer_ids[0].is_correct = val | ||
question.answer_ids[1].is_correct = val | ||
self.assertTrue(question.answers_validation_error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters