[IMP] website_slides: Add elearning feature to slides
Purpose of this commit is to introduce a new way of displaying and managing slides in eLearning module. Its purpose is to give a better experience to users when going through a course. Notably a fullscreen mode allows to take lessons one by one without going out of the elearning display. Integration of all slide types eases taking the course step by step. Quiz are introduced in this commit. Those are an addition to slides with some question / answers (multiple choice). It allows customer to gain karma and improves gamification. Certifications are still done using the survey application. Quiz targets only small tests at the end of a given slide. A new widget is added to display and control slide display in fullscreen mode. Old display is still available for documentation channels or when going out of fullscreen mode, to see details on comments / review / statistics and have access to share options. This commit is linked to task ID 1902304 and PR #29876. It closes the main work on refactoring website slides into eLearning, with other tasks already merged in current community [1][2][3][4][5]. [1] Task ID 1940360 landed atb2149bc7a2: certification inclusion [2] Task ID1936153landed at6c6179e57c: homepage inclusion [3] Task ID 1937160 landed at8b7605c9e5: selling courses [4] Task ID 1922159 and 1940516 landed at5fa651cb01and6a64c3ce82: new user profile and gamification of slides / forum [5] Task ID 1938643 landed at77b5673a0d: upload channel/slide
This commit is contained in:
committed by
Thibault Delavallée
parent
7a80ebe35e
commit
c564ae6c87
@@ -23,12 +23,14 @@ class SlidePartnerRelation(models.Model):
|
||||
_description = 'Slide / Partner decorated m2m'
|
||||
_table = 'slide_slide_partner'
|
||||
|
||||
slide_id = fields.Many2one('slide.slide', index=True, required=True)
|
||||
slide_id = fields.Many2one('slide.slide', ondelete="cascade", index=True, required=True)
|
||||
channel_id = fields.Many2one('slide.channel', string="Channel", related="slide_id.channel_id", store=True, index=True)
|
||||
partner_id = fields.Many2one('res.partner', index=True, required=True)
|
||||
vote = fields.Integer('Vote', default=0)
|
||||
completed = fields.Boolean('Completed')
|
||||
|
||||
quiz_attempts_count = fields.Integer(string="Number of times this user attempted the quiz")
|
||||
|
||||
|
||||
class SlideLink(models.Model):
|
||||
_name = 'slide.slide.link'
|
||||
@@ -95,6 +97,7 @@ class Slide(models.Model):
|
||||
'most_voted': 'likes desc',
|
||||
'latest': 'date_published desc',
|
||||
}
|
||||
_order = 'category_sequence asc, sequence asc'
|
||||
|
||||
_sql_constraints = [
|
||||
('exclusion_html_content_and_url', "CHECK(html_content IS NULL OR url IS NULL)", "A slide is either filled with a document url or HTML content. Not both.")
|
||||
@@ -106,6 +109,8 @@ class Slide(models.Model):
|
||||
# description
|
||||
name = fields.Char('Title', required=True, translate=True)
|
||||
active = fields.Boolean(default=True)
|
||||
sequence = fields.Integer('Sequence', default=10)
|
||||
category_sequence = fields.Integer('Category sequence', related="category_id.sequence", store=True)
|
||||
user_id = fields.Many2one('res.users', string='Uploaded by', default=lambda self: self.env.uid)
|
||||
description = fields.Text('Description', translate=True)
|
||||
channel_id = fields.Many2one('slide.channel', string="Channel", required=True)
|
||||
@@ -126,15 +131,24 @@ class Slide(models.Model):
|
||||
partner_ids = fields.Many2many('res.partner', 'slide_slide_partner', 'slide_id', 'partner_id',
|
||||
string='Subscribers', groups='base.group_website_publisher')
|
||||
slide_partner_ids = fields.One2many('slide.slide.partner', 'slide_id', string='Subscribers information', groups='base.group_website_publisher')
|
||||
user_membership_id = fields.Many2one('slide.slide.partner', string="Subscriber information", compute='_compute_user_membership_id',
|
||||
user_membership_id = fields.Many2one(
|
||||
'slide.slide.partner', string="Subscriber information", compute='_compute_user_membership_id',
|
||||
help="Subscriber information for the current logged in user")
|
||||
# Quiz related fields
|
||||
question_ids = fields.One2many("slide.question","slide_id", string="Questions")
|
||||
quiz_first_attempt_reward = fields.Integer("First attempt reward", default=10)
|
||||
quiz_second_attempt_reward = fields.Integer("Second attempt reward", default=7)
|
||||
quiz_third_attempt_reward = fields.Integer("Third attempt reward", default=5,)
|
||||
quiz_fourth_attempt_reward = fields.Integer("Reward for every attempt after the third try", default=2)
|
||||
|
||||
# content
|
||||
slide_type = fields.Selection([
|
||||
('infographic', 'Infographic'),
|
||||
('webpage', 'Web Page'),
|
||||
('presentation', 'Presentation'),
|
||||
('document', 'Document'),
|
||||
('webpage', 'Web Page'),
|
||||
('video', 'Video')],
|
||||
('video', 'Video'),
|
||||
('quiz', "Quiz")],
|
||||
string='Type', required=True,
|
||||
default='document', readonly=True,
|
||||
help="The document type will be set automatically based on the document URL and properties (e.g. height and width for presentation and document).")
|
||||
|
||||
Reference in New Issue
Block a user