Commit Graph
20 Commits
Author SHA1 Message Date
Aurélien Warnon ab0b36e8a5 [REF] website_slides: rename slide.slide fields
This commit simply applies the following renames in the slide.slide model:

- 'datas' is renamed into 'binary_content'
- 'slide_type' is renamed into 'slide_category'

This changes intend to ease the next bug refactoring of the website_slide
module content management.

There should be no functional changes applied in this commit.

Task-2510174

Part-of: odoo/odoo#71477
2021-11-30 15:21:47 +00:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
Priyanka Kakadiya c7f4f6d978 [IMP] website_slides_survey: share channel from result page
This commit enables eLearning users to share the channel linked to
certification they cleared directly from the result page.

Notes:

1 - We already have the option to share a certificate from the user info page
    or from the slide page, and the same mechanism has been utilised here.
2 - With a recent commit[1], top padding was added to the modal opened on
    website front-end to prevent modal overlapping the navbar. But it caused
    a side effect on survey result page, where navbar is hidden. So we remove
    this top padding on modal for the survey result page.

[1] - https://github.com/odoo/odoo/commit/6ef622772f7d0172553aca6dbce9eb71855460d7

taskId - 2337696

closes odoo/odoo#58104

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-19 10:58:39 +00:00
Adrian Torres b7017e58cc [FIX] *: adapt business code to function-redefined error
This commit adapts the business code in which
class/module/function/method redefinition took place so that it no
longer happens and the pylint test passes.
2020-10-16 12:56:52 +00:00
Patrick Hoste b39f4b6307 [REF] website(_sale)_slides(_survey): improve course management and creation
PURPOSE

Improve usability of course creation and management in frontend

SPECIFICATIONS

This commit improves various elements of the eLearning module:
  * the create 'new course' dialog has been improved with examples and
    improved placeholders;
  * allow to create tags directly from course creation modal. Using the
    add tag button after having created the course is not the only way of
    managing tags anymore;
  * the create 'new content' dialog has some explanations on the right side;
  * add a flag indicating which content has already been viewed in
    documentation;
  * changes the text/color of some buttons;

LINKS

Task ID-2241513
PR #55698
2020-08-11 10:22:23 +00:00
Thibault Delavallée b72b29f990 [IMP] website_slides_survey: merge slides controller files
Two files holding slides-related controllers exist. Let us merge them in
a single one to simplify organization.

Task ID 1981399
2020-04-16 10:26:32 +00:00
Florent LejolyandDavid Beguin 24033e4aaf [IMP] website_slides,_survey: allow certification creation at frontend
Purpose
=======

Before this commit, in the front end, you had to create a certification before
adding it to a course. This commit allows creation of certification in
front-end with pre-filled settings.

Functional Spec
===============

1. On a course, add content, type certification, you can choose an existing one
   (normal flow) or create a new one in the dropdown by typing a new survey
   name (new flow).
3. When submitting (Publish or save as draft), a certification survey, with
   pre-filled settings is created and linked to the slide.
   Pre-filled settings:
        * One page per question
        * Attempts limit : 1
        * Time limit : no limit
        * Scoring without answers
        * Passing score : 70%
        * Is Certification : True
        * Email Template : Certification: Send by email
        * Give Badge : False
4. After submit, the user stays on the Course Content.
5. A toaster is displayed in the top right saying:
    Toaster's Title: Certification created
    Content: Follow this link to add questions to your certification.
    <a>Edit certification</a>

A website editor can select a certification (if available) for the creation of
a slide.

Task id: 1981399
PR #43577

Co-Authored-By: Florent Lejoly <fle@odoo.com>
Co-Authored-By: David Beguin <dbe@odoo.com>
2020-04-16 10:26:32 +00:00
Thibault Delavallée 755ac5f313 [REF] survey: on survey.user_input, rename some fields to ease understanding
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: RENAME QUIZ_SCORE ON SURVEY.USER_INPUT

On survey.user_input, quiz_score field to scoring_percentage

``quiz_score`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME QUIZZ_PASSED ON SURVEY.USER_INPUT

on survey.user_input, rename quizz_passed field to scoring_success

``quizz_passed`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME TOKEN ON SURVEY.USER_INPUT

on survey.user_input, rename token field to access_token

Survey user input model holds two token field. One is used to distinguish
a pool of attempts linked to a given invite: ``invite_token``. The other
one is used to control access to a specific user input. It means that
``invite_token`` indicates a set of user inputs and each of them is accessed
through its own ``token``. To be coherent with other naming in odoo this
latter field is renamed to ``access_token``.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
Thibault Delavallée 1e66894042 [REF] survey: on survey.survey, rename some fields to ease understanding
PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: RENAME THANKS_YOU_MESSAGE ON SURVEY.SURVEY

On survey.survey, rename thanks_you_message to description_done

In this commit we rename thanks_you_message field. Indeed for certifications
or recruitment form, "thank you" is not really the unique content you
would get in a post-survey message. We therefore rename it to description_done
to better indicate its use.

SPECIFICATIONS: RENAME CERTIFICATE ON SURVEY.SURVEY

On survey.survey, rename certificate field to certification

All certification related fields on survey model begin with certification_ .
Only the boolean one telling if a survey is a certification or not is called
certificate. In order to ease grep and ordering it is renamed to certification.

SPECIFICATIONS: RENAME PASSING_SCORE ON SURVEY.SURVEY

on survey.survey, rename passing_score field to scoring_success_min

``passing_score`` field name is not really the best name we could find.
Renaming the field using a ``scoring_`` prefix allow to know this field
is linked to the scoring mechanism.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
2019-12-05 15:21:28 +00:00
David Beguin 5ac64d6e02 [IMP] website_slides_survey: add certification badges section to ranks badge page
This commit adds a section to distinguish the certification badges from the
other badges users may obtain in eLearning. Certification badges are available
on the ranks page, linked to a running survey. Clicking on them directly
redirects into the linked course.

Task ID : 1961053
PR #32594
2019-11-22 15:30:53 +00:00
qmo-odoo 75153e72bc [IMP] website_slides: Improve methods to get user certificates
This commit improves a few methods related to the user profiles:
- Change _prepare_all_users_values so that it
works with a batch of users
- Change the _get_user_certificates and rename it to _get_users_certificates
so that it works with a batch of users to avoid doing a search in a
list comprehension.
This method will also be used to get the number of certificates per users

TaskID: 1952064
PR: #32229

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-07-30 13:03:35 +00:00
qmo-odoo 258a1e41b0 [FIX] website_slides: fix various quiz-related issues
This commit provides a few fixes for quiz feature:

  * fix amount of karma won by the user in a quiz;
  * correctly display the fact that a subquiz was completed by the user instead
    of just looking like a non-completed quiz;
  * going on a previously completed quiz, good answers are hightlighted and
    inputs disabled;
  * effectively put the quiz in readonly mode if not a channel member.

Commit linked to task ID 1941250 and PR #31977
2019-03-21 11:44:09 +00:00
Aurélien Warnon 199ecdd30f [IMP] website_slides_survey: handle certification re-enroll/purchase flow
Task #1945036

Purpose
=======

If the user fails his last attempt at a course certification, we remove him from
the members of the course (and he has to enroll again).
He receives an email in the process notifying him of his failure and suggesting
he enrolls to the course again.

The purpose is to have a 'certification flow' where the user can re-purchase the
certification when they have failed it.

This could lead to some issues if the course containing the certification also has
other slides with content because the user will not have access to them after failing.
This also prevents configuring courses with multiple certifications since the membership
will be removed at the first failure.

These use cases are considered "non standard" by the business and are thus not handled
in the code. We assume that users will configure their courses "correctly".
2019-03-18 14:46:32 +00:00
qmo-odoo e8e8d7a956 [FIX] website_slides_survey: certification slide url
Before this commit, in fullscreen mode, clicking on the "pass certification"
button would redirect the user to the "non-fullscreen" view.
After this commit, the button directly redirects the user to the survey page.

To avoid generating user_input of survey (test entry or not) for
certification slides in fullscreen mode (table of content), we decided
to create those user_input lazily: we redirect the user to a route that
create (or reuse) the correct user_input.

Task-1946511
2019-03-15 20:38:58 +00:00
jem-odoo 32c5632aa5 [FIX] website_slides: auto set done successfull quizz
For now, in no fullscreen mode, if the quiz is succeed, the
user progress is not updated because the quiz is not set
to done.
This commit implements this call to mark slide as done and
green the check bullet.
We decided to unify the submit RPC call with the done one,
so a quiz (or a slide with questions) can only be done when
submitting answers. As consequence, we need to prevent some
slide type to use the /set_completed route (quiz and certif).

Task-1941250
2019-03-15 20:38:58 +00:00
David Beguin d7cc1520f4 [IMP] website_profile, gamification, : add search bar in all users page
This commit adds the search bar in 'All users' page in order to filter on name or company name.
To be able to keep the position, a non stored computed field has been added on res_users
to get the position depending on the user's karma.

The podium (top 3 users) is now displayed only if there is no search applied and if the page = 1
because it has no sens anymore in other cases.

Special thanks to @jem-odoo who helped me finding smart solution for position computing.

Task ID : 1943788
PR #31321
2019-03-15 14:59:12 +00:00
Thibault Delavallée 7afd23e56c [FIX] website_slides: various fixes
Display
 * improve color of trophy displayed on top of course main page (success if
   course done, warning while working on it);
 * correctly fetch and display karma/xp points on course lesson list. It is
   either gain of next try, either awarded points depending on slide
   completion;
 * fix control buttons in course main page (prev, next, set done,
   set completed, fullscren), notably correctly set them disabled;

Linting / Code
 * put demo in no update;
 * rename some parameter in website_slides_survey to avoid conflict between
   quiz (on a slide) and certification (a survey);

 Commit linked to task ID 1941250 and PR #31697.

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-08 11:15:07 +00:00
David Beguin 2c01452d4b [IMP] website(_profile,_forum,_survey) : redesign website all_users page
As the eLearning (website_slides) is also using website_profile users,
the All Users page is moved from website_forum to website_profile, to be
useable in both forum and eLearning.

This page displays also the number of karma point, badges and certificates
of each user.

The users are sorted by their karma points and the first 3 users are
promoted on a podium.

Use span instead of b tag in profile page

Task ID : 1922159
PR #31109
2019-02-18 15:15:06 +00:00
David Beguin 5125eecce5 [IMP] website_slides_survey : add certifications in website profile page
For users viewing their own profile page on the website,
a new section 'Certifications' is added to the about tab.
Thoses certifications are the survey that activated certificate.

Task ID : 1922159
PR #31109
2019-02-18 15:15:06 +00:00
Aurélien Warnon f322816ae8 [ADD] website_slides_survey: add a new bridge between slide and survey
Task #1940360
Subtask of #1902304

Purpose
=======

Adds certification capabilities to the website_slides module.
Channel/courses can now include certifications as a new type of slide.

This new type of slide is available as a "Certification" button on the slide creation
frontend view (next to "Video", "Presentation", ...).
Users have to link the slide to an actual survey that has the 'certificate' field
set to true (that will populate the slide's survey_id field).

Slides of type certification are handled in frontend in a very simple way for now:
- A button "Begin certification" that redirects the user to the related survey frontend.
- A button "Download certification" when the user has succeeded the certification.
- When the survey is done, if it's linked to a slide, a button "Go back to course" allows
  the user to go back to the slide frontend.

(There is a special use case for when the website_publisher designing the survey lands on a
certification slide: he is allowed to test the survey with a survey_input created as test_entry)

Survey creation as well as limited time, limited number of attempts, ... are still completely
handled in the survey module. That means that the user will have to first create a suitable survey
that is a certification and only then create a slide of type "certification" and link
the created survey to it.

Ideally, the taking of the survey should be transparently included in the slide frontend but
it requires a full refactoring of the way surveys are submitted. This will most likely come in
a later commit.

This commit is an advanced merge of full eLearning module (see task #1902304).
2019-02-15 15:32:46 +00:00