Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MERGE] survey: clean models #40765

Closed
wants to merge 19 commits into from
Closed

Conversation

@tde-banana-odoo
Copy link
Contributor

tde-banana-odoo commented Nov 25, 2019

No description provided.

@robodoo robodoo added the seen 🙂 label Nov 25, 2019
@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-survey-2-tde branch from d259ae7 to 935c93d Nov 25, 2019
@C3POdoo C3POdoo added the RD label Nov 25, 2019
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Question model holds two fields for its title, title and question. It
is mainly due to historical reasons, when updating models for certifications
and eLearning.

In this commit we keep only title field and remove the question related
field as it adds unnecessary complexity to the model.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
…ollect

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open, either closed.

Since eLearning and certification surveys access mode on surveys have
evolved quite a lot. Being able to distinguish manual from invite user inputs
has no real use in Odoo. Indeed what is important is the way people can
reach the survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
…o data

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

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.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we remove some remaining of URL fields that are better
found using methods. Both survey and user input holds a "start" url
field that is replaced by a method call.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Survey holds a ``category`` field whose purpose is to be able to categorized
surveys according to their use. However using this field is not easy and
its sole use is in ``hr_recruitment_survey`` which is a niche module.

Let us clean models and remove artefacts of old code and remove this field.

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 odoo#40765
@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-survey-2-tde branch from 0dfc313 to f4d4415 Nov 25, 2019
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Question model holds two fields for its title: ``title`` and ``question``. It
is mainly due to historical reasons, when updating models for certifications
and eLearning. In this commit we keep only title field and remove the question
related field as it adds unnecessary complexity to the model.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
…ollect

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
… void demo data

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

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.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

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.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

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 odoo#40765
@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-survey-2-tde branch from 122d715 to 1d54778 Nov 25, 2019
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Question model holds two fields for its title: ``title`` and ``question``. It
is mainly due to historical reasons, when updating models for certifications
and eLearning. In this commit we keep only title field and remove the question
related field as it adds unnecessary complexity to the model.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
…ollect

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
… void demo data

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

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.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

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.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 25, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

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 odoo#40765
@tde-banana-odoo tde-banana-odoo force-pushed the odoo-dev:master-survey-2-tde branch from 1d54778 to f0143df Nov 25, 2019
@robodoo robodoo added the CI 🤖 label Nov 25, 2019
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 26, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Question model holds two fields for its title: ``title`` and ``question``. It
is mainly due to historical reasons, when updating models for certifications
and eLearning. In this commit we keep only title field and remove the question
related field as it adds unnecessary complexity to the model.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 26, 2019
…ollect

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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 26, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 26, 2019
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.

Purpose is to perform some cleaning in survey models: removing unnecessary
fields, performing some cleaning and finally renaming models. Indeed survey
models are known to be quite badly named and difficult to understand.

SPECIFICATIONS

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 5, 2019
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

This commit lints JS files located in survey as some typos and mistakes
were recently introduced. Code related to routes is also slightly reorganized
to better understand file main sections.

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 5, 2019
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

Purpose of this commit is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

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 odoo#40765
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 5, 2019
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

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

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 odoo#40765
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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

Add math floor and ceil functions in qweb rendering context. It allows to use
some math methods directly in templates to avoid unnecessary data preparation
in controllers that lead to a lot of hard to read code mixed with important
code. Notably in survey we will use them for some pagination within statistics
rendering.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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: QUESTION FIELD ON SURVEY.SURVEY

On survey.survey, remove question field, unnecessary related on title.

Question model holds two fields for its title: ``title`` and ``question``.
Question is simply a related on title, making the two fields completely
redundant. It is mainly due to historical reasons, when updating models for
certifications and eLearning. In this commit we keep only title field and
remove the question related field as it adds unnecessary complexity to the
model.

SPECIFICATIONS: INPUT_TYPE FIELD ON SURVEY.USER_INPUT

On survey.user_input, remove input_type and its garbage collect.

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

SPECIFICATIONS: REPLACE URLS FIELDS BY METHODS ON SURVEY.{SURVEY, USER_INPUT}

On survey.{survey, user_input}, remove url fields replaced by methods

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call ``get_start_url`` on both survey (generic) and
user input (token specific) models. We also introduced a ``get_print_url``
method doing the same for the printable version of survey / user input.

SPECIFICATIONS: REMOVE CATEGORY FIELD ON SURVEY.SURVEY

On survey.survey, remove unused category field.

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
…nswer

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

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
…user_input.line

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

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
…tanding

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
… fields

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

A new naming for ``survey.question.answer`` has been recently introduced:
``suggested_answer_ids`` and ``matrix_row_ids``. In this commit we propagate
that naming to survey.user_input.line model. New naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicates the use;

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
…efined_question_ids

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

``question_ids`` field name is quite difficult to understand as we wonder why
there is such a field on user input model. As its purpose is to store questions
user has to answer (randomly chosen or all chosen) let us rename it to
``predefined_question_ids``.

Moreover starting from now on if it is now given at create it is automatically
computed. Classic flows go through ``survey._create_answer()`` method that
prepares them accordingly. However tests or demo data do not necessarily go
through that method and it makes scoring fail (notably) if people forget
to define them.

Let us automatically generate them at user input create if not given.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
…ld names match

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

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
… code

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

In survey.user_input.line, clean code about constraints. Purpose is to make
it easier to read and understand.

Code creating user input lines is moved from survey.user_input.line model to
survey.user_input. Indeed it is now based on a user_input record, and create
answer line related to a question, based on values coming from controllers
(and therefore frontend). It makes more sense to delegate that code to the
user_input model itself that creates its lines. Code is also rewritten to
be cleaner and easier to read.

Code computing statistics on user input records is moved from survey model
to user_input model, where it belongs. Missing translation marks are added
because translations matter.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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

This commit lints JS files located in survey as some typos and mistakes
were recently introduced. Code related to routes is also slightly reorganized
to better understand file main sections.

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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

Purpose of this commit is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

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
robodoo pushed a commit that referenced this pull request Dec 5, 2019
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

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

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
robodoo added a commit that referenced this pull request Dec 5, 2019
… code

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

[REF] survey: remove unused or unnecessary fields to clean models. Some fields
are also renamed to better indicate their use.

  * On survey.survey, remove question field, unnecessary related on title.
  * On survey.survey, remove unused category field.
  * On survey.user_input, remove input_type and its garbage collect.
  * On survey.{survey, user_input}, remove url fields replaced by methods

  * On survey.survey, rename thanks_you_message to description_done
  * On survey.survey, rename certificate field to certification
  * On survey.survey, rename passing_score field to scoring_success_min
  * On survey.user_input, rename quiz_score field to scoring_percentage
  * On survey.user_input, rename quizz_passed field to scoring_success
  * On survey.user_input, rename token field to access_token
  * On survey.user_input, rename question_ids field to predefined_question_ids

[REF] survey: rename some models to ease understanding

In this merge we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

[REF] survey: on survey.user_input.line, rename value_suggested{_row}

A new naming recently introduced for ``survey.question.answer`` has been
recently introduced: ``suggested_answer_ids`` and ``matrix_row_ids``. In
this commit we propagate that naming to survey.user_input.line model. New
naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicate the use;

 [REF] survey: on survey.{question,user_input.line}, make type and field names match

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

[REF] survey: refactor results page

Purpose of this merge is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

[IMP] survey: improve demo data

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

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

closes #41198

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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

Add math floor and ceil functions in qweb rendering context. It allows to use
some math methods directly in templates to avoid unnecessary data preparation
in controllers that lead to a lot of hard to read code mixed with important
code. Notably in survey we will use them for some pagination within statistics
rendering.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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: QUESTION FIELD ON SURVEY.SURVEY

On survey.survey, remove question field, unnecessary related on title.

Question model holds two fields for its title: ``title`` and ``question``.
Question is simply a related on title, making the two fields completely
redundant. It is mainly due to historical reasons, when updating models for
certifications and eLearning. In this commit we keep only title field and
remove the question related field as it adds unnecessary complexity to the
model.

SPECIFICATIONS: INPUT_TYPE FIELD ON SURVEY.USER_INPUT

On survey.user_input, remove input_type and its garbage collect.

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

SPECIFICATIONS: REPLACE URLS FIELDS BY METHODS ON SURVEY.{SURVEY, USER_INPUT}

On survey.{survey, user_input}, remove url fields replaced by methods

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call ``get_start_url`` on both survey (generic) and
user input (token specific) models. We also introduced a ``get_print_url``
method doing the same for the printable version of survey / user input.

SPECIFICATIONS: REMOVE CATEGORY FIELD ON SURVEY.SURVEY

On survey.survey, remove unused category field.

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
…nswer

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

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
…user_input.line

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

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
…tanding

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
… fields

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

A new naming for ``survey.question.answer`` has been recently introduced:
``suggested_answer_ids`` and ``matrix_row_ids``. In this commit we propagate
that naming to survey.user_input.line model. New naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicates the use;

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
…efined_question_ids

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

``question_ids`` field name is quite difficult to understand as we wonder why
there is such a field on user input model. As its purpose is to store questions
user has to answer (randomly chosen or all chosen) let us rename it to
``predefined_question_ids``.

Moreover starting from now on if it is now given at create it is automatically
computed. Classic flows go through ``survey._create_answer()`` method that
prepares them accordingly. However tests or demo data do not necessarily go
through that method and it makes scoring fail (notably) if people forget
to define them.

Let us automatically generate them at user input create if not given.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
…ld names match

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

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
… code

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

In survey.user_input.line, clean code about constraints. Purpose is to make
it easier to read and understand.

Code creating user input lines is moved from survey.user_input.line model to
survey.user_input. Indeed it is now based on a user_input record, and create
answer line related to a question, based on values coming from controllers
(and therefore frontend). It makes more sense to delegate that code to the
user_input model itself that creates its lines. Code is also rewritten to
be cleaner and easier to read.

Code computing statistics on user input records is moved from survey model
to user_input model, where it belongs. Missing translation marks are added
because translations matter.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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

This commit lints JS files located in survey as some typos and mistakes
were recently introduced. Code related to routes is also slightly reorganized
to better understand file main sections.

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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

Purpose of this commit is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...

In this commit we rewrite that part. Including

  * a simpler code flow;
  * a simpler data structure;
  * use a better naming for methods instead of "prepare_results" called
    randomly within the code and re-using part of its returned content;
  * use record sets / records instead of giving sub-elements of a record
    like question.title, label.value, ...

Data structure

  * simply give a question_and_page_ids to the template that will iterate
    on pages / questions;
  * have a graph_data, table_data dictionaries available for graph and
    table display with simple entries;
  * graph_data: holding all necessary but minimalist data for graph display
    if question allows it;
  * table_data: holding all necessary but minimalist data for table / summary
    display;
  * hold record sets of done / failed answers and answer lines;

In this commit we also simplify and clean pagination in survey graph results

  * remove page_range helper tool that can be inlined in the templates
    directly, doing a simple range;
  * fix and improve pagination code;

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 odoo#40765
bbh-odoo added a commit to odoo-dev/odoo that referenced this pull request Dec 9, 2019
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

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

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 odoo#40765
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.