summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/hr_recruitment_survey/tests/test_recruitment_survey.py4
-rw-r--r--addons/hr_skills_survey/models/survey_user.py2
-rw-r--r--addons/survey/controllers/main.py44
-rw-r--r--addons/survey/models/res_partner.py2
-rw-r--r--addons/survey/models/survey_survey.py16
-rw-r--r--addons/survey/models/survey_user.py40
-rw-r--r--addons/survey/static/src/js/survey_result.js4
-rw-r--r--addons/survey/tests/test_certification_flow.py6
-rw-r--r--addons/survey/tests/test_survey_flow.py2
-rw-r--r--addons/survey/views/res_partner_views.xml2
-rw-r--r--addons/survey/views/survey_templates.xml6
-rw-r--r--addons/survey/views/survey_templates_management.xml16
-rw-r--r--addons/survey/views/survey_templates_statistics.xml14
-rw-r--r--addons/survey/views/survey_user_views.xml18
-rw-r--r--addons/website_slides_survey/controllers/slides.py4
-rw-r--r--addons/website_slides_survey/data/gamification_data.xml2
-rw-r--r--addons/website_slides_survey/models/slide_slide.py18
-rw-r--r--addons/website_slides_survey/models/survey_user.py2
-rw-r--r--addons/website_slides_survey/tests/test_course_certification_failure.py4
-rw-r--r--addons/website_slides_survey/views/website_profile.xml2
20 files changed, 104 insertions, 104 deletions
diff --git a/addons/hr_recruitment_survey/tests/test_recruitment_survey.py b/addons/hr_recruitment_survey/tests/test_recruitment_survey.py
index f7a6ac20df3..f47ad40a1be 100644
--- a/addons/hr_recruitment_survey/tests/test_recruitment_survey.py
+++ b/addons/hr_recruitment_survey/tests/test_recruitment_survey.py
@@ -31,7 +31,7 @@ class TestRecruitmentSurvey(common.SingleTransactionCase):
action_start = self.job_sysadmin.action_start_survey()
self.assertEqual(action_start['type'], 'ir.actions.act_url')
self.assertNotEqual(self.job_sysadmin.response_id.id, False)
- self.assertIn(self.job_sysadmin.response_id.token, action_start['url'])
+ self.assertIn(self.job_sysadmin.response_id.access_token, action_start['url'])
action_start_with_response = self.job_sysadmin.action_start_survey()
self.assertEqual(action_start_with_response, action_start)
@@ -42,4 +42,4 @@ class TestRecruitmentSurvey(common.SingleTransactionCase):
self.assertEqual(action_print['type'], 'ir.actions.act_url')
self.job_sysadmin.response_id = self.env['survey.user_input'].create({'survey_id': self.survey_sysadmin.id})
action_print_with_response = self.job_sysadmin.action_print_survey()
- self.assertIn(self.job_sysadmin.response_id.token, action_print_with_response['url'])
+ self.assertIn(self.job_sysadmin.response_id.access_token, action_print_with_response['url'])
diff --git a/addons/hr_skills_survey/models/survey_user.py b/addons/hr_skills_survey/models/survey_user.py
index e9cecf321e6..9e2faff8732 100644
--- a/addons/hr_skills_survey/models/survey_user.py
+++ b/addons/hr_skills_survey/models/survey_user.py
@@ -16,7 +16,7 @@ class SurveyUserInput(models.Model):
super(SurveyUserInput, self)._mark_done()
- certification_user_inputs = self.filtered(lambda user_input: user_input.survey_id.certification and user_input.quizz_passed)
+ certification_user_inputs = self.filtered(lambda user_input: user_input.survey_id.certification and user_input.scoring_success)
partner_has_completed = {user_input.partner_id.id: user_input.survey_id for user_input in certification_user_inputs}
employees = self.env['hr.employee'].sudo().search([('user_id.partner_id', 'in', certification_user_inputs.mapped('partner_id').ids)])
for employee in employees:
diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py
index 57cdb2692c4..68bb741d318 100644
--- a/addons/survey/controllers/main.py
+++ b/addons/survey/controllers/main.py
@@ -34,7 +34,7 @@ class Survey(http.Controller):
else:
answer_sudo = request.env['survey.user_input'].sudo().search([
('survey_id', '=', survey_sudo.id),
- ('token', '=', answer_token)
+ ('access_token', '=', answer_token)
], limit=1)
return survey_sudo, answer_sudo
@@ -127,20 +127,20 @@ class Survey(http.Controller):
return request.render("survey.survey_void_content", {'survey': survey_sudo, 'answer': answer_sudo})
elif error_key == 'survey_closed' and access_data['can_answer']:
return request.render("survey.survey_closed_expired", {'survey': survey_sudo})
- elif error_key == 'survey_auth' and answer_sudo.token:
+ elif error_key == 'survey_auth' and answer_sudo.access_token:
if answer_sudo.partner_id and (answer_sudo.partner_id.user_ids or survey_sudo.users_can_signup):
if answer_sudo.partner_id.user_ids:
answer_sudo.partner_id.signup_cancel()
else:
answer_sudo.partner_id.signup_prepare(expiration=fields.Datetime.now() + relativedelta(days=1))
- redirect_url = answer_sudo.partner_id._get_signup_url_for_action(url='/survey/start/%s?answer_token=%s' % (survey_sudo.access_token, answer_sudo.token))[answer_sudo.partner_id.id]
+ redirect_url = answer_sudo.partner_id._get_signup_url_for_action(url='/survey/start/%s?answer_token=%s' % (survey_sudo.access_token, answer_sudo.access_token))[answer_sudo.partner_id.id]
else:
- redirect_url = '/web/login?redirect=%s' % ('/survey/start/%s?answer_token=%s' % (survey_sudo.access_token, answer_sudo.token))
+ redirect_url = '/web/login?redirect=%s' % ('/survey/start/%s?answer_token=%s' % (survey_sudo.access_token, answer_sudo.access_token))
return request.render("survey.survey_auth_required", {'survey': survey_sudo, 'redirect_url': redirect_url})
- elif error_key == 'answer_deadline' and answer_sudo.token:
+ elif error_key == 'answer_deadline' and answer_sudo.access_token:
return request.render("survey.survey_closed_expired", {'survey': survey_sudo})
- elif error_key == 'answer_done' and answer_sudo.token:
- return request.render("survey.survey_closed_finished", self._prepare_survey_finished_values(survey_sudo, answer_sudo, token=answer_sudo.token))
+ elif error_key == 'answer_done' and answer_sudo.access_token:
+ return request.render("survey.survey_closed_finished", self._prepare_survey_finished_values(survey_sudo, answer_sudo, token=answer_sudo.access_token))
return werkzeug.utils.redirect("/")
@@ -153,7 +153,7 @@ class Survey(http.Controller):
answer_sudo = survey_sudo._create_answer(user=request.env.user, test_entry=True)
except:
return werkzeug.utils.redirect('/')
- return request.redirect('/survey/start/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=answer_sudo.token)))
+ return request.redirect('/survey/start/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=answer_sudo.access_token)))
@http.route('/survey/retry/<string:survey_token>/<string:answer_token>', type='http', auth='public', website=True)
def survey_retry(self, survey_token, answer_token, **post):
@@ -178,7 +178,7 @@ class Survey(http.Controller):
)
except:
return werkzeug.utils.redirect("/")
- return request.redirect('/survey/start/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=retry_answer_sudo.token)))
+ return request.redirect('/survey/start/%s?%s' % (survey_sudo.access_token, keep_query('*', answer_token=retry_answer_sudo.access_token)))
def _prepare_retry_additional_values(self, answer):
return {
@@ -220,7 +220,7 @@ class Survey(http.Controller):
data = {'survey': survey_sudo, 'answer': answer_sudo, 'page': 0}
return request.render('survey.survey_page_start', data)
else:
- return request.redirect('/survey/fill/%s/%s' % (survey_sudo.access_token, answer_sudo.token))
+ return request.redirect('/survey/fill/%s/%s' % (survey_sudo.access_token, answer_sudo.access_token))
@http.route('/survey/fill/<string:survey_token>/<string:answer_token>', type='http', auth='public', website=True)
def survey_display_page(self, survey_token, answer_token, **post):
@@ -459,7 +459,7 @@ class Survey(http.Controller):
succeeded_attempt = request.env['survey.user_input'].sudo().search([
('partner_id', '=', request.env.user.partner_id.id),
('survey_id', '=', survey_id),
- ('quizz_passed', '=', True)
+ ('scoring_success', '=', True)
], limit=1)
if not succeeded_attempt:
@@ -542,31 +542,31 @@ class Survey(http.Controller):
count_data = request.env['survey.user_input'].read_group(
[('survey_id', '=', survey.id), ('state', '=', 'done'), ('test_entry', '=', False)],
- ['quizz_passed', 'id:count_distinct'],
- ['quizz_passed']
+ ['scoring_success', 'id:count_distinct'],
+ ['scoring_success']
)
- quizz_passed_count = 0
- quizz_failed_count = 0
+ scoring_success_count = 0
+ scoring_failed_count = 0
for count_data_item in count_data:
- if count_data_item['quizz_passed']:
- quizz_passed_count = count_data_item['quizz_passed_count']
+ if count_data_item['scoring_success']:
+ scoring_success_count = count_data_item['scoring_success_count']
else:
- quizz_failed_count = count_data_item['quizz_passed_count']
+ scoring_failed_count = count_data_item['scoring_success_count']
graph_data = [{
'text': _('Passed'),
- 'count': quizz_passed_count,
+ 'count': scoring_success_count,
'color': '#2E7D32'
}, {
'text': _('Missed'),
- 'count': quizz_failed_count,
+ 'count': scoring_failed_count,
'color': '#C62828'
}]
- total_quizz_passed = quizz_passed_count + quizz_failed_count
+ total_scoring_success = scoring_success_count + scoring_failed_count
return {
- 'success_rate': round((quizz_passed_count / total_quizz_passed) * 100, 1) if total_quizz_passed > 0 else 0,
+ 'success_rate': round((scoring_success_count / total_scoring_success) * 100, 1) if total_scoring_success > 0 else 0,
'graph_data': graph_data
}
diff --git a/addons/survey/models/res_partner.py b/addons/survey/models/res_partner.py
index 41ce56ddc0a..93161222c12 100644
--- a/addons/survey/models/res_partner.py
+++ b/addons/survey/models/res_partner.py
@@ -13,7 +13,7 @@ class ResPartner(models.Model):
@api.depends('is_company')
def _compute_certifications_count(self):
read_group_res = self.env['survey.user_input'].sudo().read_group(
- [('partner_id', 'in', self.ids), ('quizz_passed', '=', True)],
+ [('partner_id', 'in', self.ids), ('scoring_success', '=', True)],
['partner_id'], 'partner_id'
)
data = dict((res['partner_id'][0], res['partner_id_count']) for res in read_group_res)
diff --git a/addons/survey/models/survey_survey.py b/addons/survey/models/survey_survey.py
index b7476bd5364..693ebe920db 100644
--- a/addons/survey/models/survey_survey.py
+++ b/addons/survey/models/survey_survey.py
@@ -122,7 +122,7 @@ class Survey(models.Model):
for survey in self:
survey.users_can_signup = signup_allowed
- @api.depends('user_input_ids.state', 'user_input_ids.test_entry', 'user_input_ids.quizz_score', 'user_input_ids.quizz_passed')
+ @api.depends('user_input_ids.state', 'user_input_ids.test_entry', 'user_input_ids.scoring_percentage', 'user_input_ids.scoring_success')
def _compute_survey_statistic(self):
default_vals = {
'answer_count': 0, 'answer_done_count': 0, 'success_count': 0,
@@ -132,13 +132,13 @@ class Survey(models.Model):
UserInput = self.env['survey.user_input']
base_domain = ['&', ('survey_id', 'in', self.ids), ('test_entry', '!=', True)]
- read_group_res = UserInput.read_group(base_domain, ['survey_id', 'state'], ['survey_id', 'state', 'quizz_score', 'quizz_passed'], lazy=False)
+ read_group_res = UserInput.read_group(base_domain, ['survey_id', 'state'], ['survey_id', 'state', 'scoring_percentage', 'scoring_success'], lazy=False)
for item in read_group_res:
stat[item['survey_id'][0]]['answer_count'] += item['__count']
- stat[item['survey_id'][0]]['answer_score_avg_total'] += item['quizz_score']
+ stat[item['survey_id'][0]]['answer_score_avg_total'] += item['scoring_percentage']
if item['state'] == 'done':
stat[item['survey_id'][0]]['answer_done_count'] += item['__count']
- if item['quizz_passed']:
+ if item['scoring_success']:
stat[item['survey_id'][0]]['success_count'] += item['__count']
for survey_id, values in stat.items():
@@ -470,7 +470,7 @@ class Survey(models.Model):
def action_start_survey(self, answer=None):
""" Open the website page with the survey form """
self.ensure_one()
- url = '%s?%s' % (self.get_start_url(), werkzeug.urls.url_encode({'answer_token': answer.token or None}))
+ url = '%s?%s' % (self.get_start_url(), werkzeug.urls.url_encode({'answer_token': answer.access_token or None}))
return {
'type': 'ir.actions.act_url',
'name': "Start Survey",
@@ -481,7 +481,7 @@ class Survey(models.Model):
def action_print_survey(self, answer=None):
""" Open the website page with the survey printable view """
self.ensure_one()
- url = '%s?%s' % (self.get_print_url(), werkzeug.urls.url_encode({'answer_token': answer.token or None}))
+ url = '%s?%s' % (self.get_print_url(), werkzeug.urls.url_encode({'answer_token': answer.access_token or None}))
return {
'type': 'ir.actions.act_url',
'name': "Print Survey",
@@ -524,7 +524,7 @@ class Survey(models.Model):
action = action_rec.read()[0]
ctx = dict(self.env.context)
ctx.update({'search_default_survey_id': self.ids[0],
- 'search_default_quizz_passed': 1,
+ 'search_default_scoring_success': 1,
'search_default_not_test': 1})
action['context'] = ctx
return action
@@ -724,7 +724,7 @@ class Survey(models.Model):
goal = self.env['gamification.goal.definition'].create({
'name': self.title,
'description': "%s certification passed" % self.title,
- 'domain': "['&', ('survey_id', '=', %s), ('quizz_passed', '=', True)]" % self.id,
+ 'domain': "['&', ('survey_id', '=', %s), ('scoring_success', '=', True)]" % self.id,
'computation_mode': 'count',
'display_mode': 'boolean',
'model_id': self.env.ref('survey.model_survey_user_input').id,
diff --git a/addons/survey/models/survey_user.py b/addons/survey/models/survey_user.py
index 0e0dd774a3d..b6ccda6539b 100644
--- a/addons/survey/models/survey_user.py
+++ b/addons/survey/models/survey_user.py
@@ -32,25 +32,25 @@ class SurveyUserInput(models.Model):
# attempts management
is_attempts_limited = fields.Boolean("Limited number of attempts", related='survey_id.is_attempts_limited')
attempts_limit = fields.Integer("Number of attempts", related='survey_id.attempts_limit')
- attempt_number = fields.Integer("Attempt n°", compute='_compute_attempt_number')
+ attempts_number = fields.Integer("Attempt n°", compute='_compute_attempts_number')
is_time_limit_reached = fields.Boolean("Is time limit reached?", compute='_compute_is_time_limit_reached')
# identification / access
- token = fields.Char('Identification token', default=lambda self: str(uuid.uuid4()), readonly=True, required=True, copy=False)
+ access_token = fields.Char('Identification token', default=lambda self: str(uuid.uuid4()), readonly=True, required=True, copy=False)
invite_token = fields.Char('Invite token', readonly=True, copy=False) # no unique constraint, as it identifies a pool of attempts
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True)
email = fields.Char('E-mail', readonly=True)
# questions / answers
user_input_line_ids = fields.One2many('survey.user_input.line', 'user_input_id', string='Answers', copy=True)
question_ids = fields.Many2many('survey.question', string='Predefined Questions', readonly=True)
- quizz_score = fields.Float("Score (%)", compute="_compute_quizz_score", store=True, compute_sudo=True) # stored for perf reasons
- quizz_passed = fields.Boolean('Quizz Passed', compute='_compute_quizz_passed', store=True, compute_sudo=True) # stored for perf reasons
+ scoring_percentage = fields.Float("Score (%)", compute="_compute_scoring_percentage", store=True, compute_sudo=True) # stored for perf reasons
+ scoring_success = fields.Boolean('Quizz Passed', compute='_compute_scoring_success', store=True, compute_sudo=True) # stored for perf reasons
_sql_constraints = [
- ('unique_token', 'UNIQUE (token)', 'A token must be unique!'),
+ ('unique_token', 'UNIQUE (access_token)', 'An access token must be unique!'),
]
@api.depends('user_input_line_ids.answer_score', 'user_input_line_ids.question_id')
- def _compute_quizz_score(self):
+ def _compute_scoring_percentage(self):
for user_input in self:
total_possible_score = sum([
answer_score if answer_score > 0 else 0
@@ -58,15 +58,15 @@ class SurveyUserInput(models.Model):
])
if total_possible_score == 0:
- user_input.quizz_score = 0
+ user_input.scoring_percentage = 0
else:
score = (sum(user_input.user_input_line_ids.mapped('answer_score')) / total_possible_score) * 100
- user_input.quizz_score = round(score, 2) if score > 0 else 0
+ user_input.scoring_percentage = round(score, 2) if score > 0 else 0
- @api.depends('quizz_score', 'survey_id.scoring_success_min')
- def _compute_quizz_passed(self):
+ @api.depends('scoring_percentage', 'survey_id.scoring_success_min')
+ def _compute_scoring_success(self):
for user_input in self:
- user_input.quizz_passed = user_input.quizz_score >= user_input.survey_id.scoring_success_min
+ user_input.scoring_success = user_input.scoring_percentage >= user_input.survey_id.scoring_success_min
@api.depends('start_datetime', 'survey_id.is_time_limited', 'survey_id.time_limit')
def _compute_is_time_limit_reached(self):
@@ -76,16 +76,16 @@ class SurveyUserInput(models.Model):
> user_input.start_datetime + relativedelta(minutes=user_input.survey_id.time_limit)
@api.depends('state', 'test_entry', 'survey_id.is_attempts_limited', 'partner_id', 'email', 'invite_token')
- def _compute_attempt_number(self):
+ def _compute_attempts_number(self):
attempts_to_compute = self.filtered(
lambda user_input: user_input.state == 'done' and not user_input.test_entry and user_input.survey_id.is_attempts_limited
)
for user_input in (self - attempts_to_compute):
- user_input.attempt_number = 1
+ user_input.attempts_number = 1
if attempts_to_compute:
- self.env.cr.execute("""SELECT user_input.id, (COUNT(previous_user_input.id) + 1) AS attempt_number
+ self.env.cr.execute("""SELECT user_input.id, (COUNT(previous_user_input.id) + 1) AS attempts_number
FROM survey_user_input user_input
LEFT OUTER JOIN survey_user_input previous_user_input
ON user_input.survey_id = previous_user_input.survey_id
@@ -101,13 +101,13 @@ class SurveyUserInput(models.Model):
attempts_count_results = self.env.cr.dictfetchall()
for user_input in attempts_to_compute:
- attempt_number = 1
+ attempts_number = 1
for attempts_count_result in attempts_count_results:
if attempts_count_result['id'] == user_input.id:
- attempt_number = attempts_count_result['attempt_number']
+ attempts_number = attempts_count_result['attempts_number']
break
- user_input.attempt_number = attempt_number
+ user_input.attempts_number = attempts_number
def action_resend(self):
partners = self.env['res.partner']
@@ -131,7 +131,7 @@ class SurveyUserInput(models.Model):
'type': 'ir.actions.act_url',
'name': "View Answers",
'target': 'self',
- 'url': '/survey/print/%s?answer_token=%s' % (self.survey_id.access_token, self.token)
+ 'url': '/survey/print/%s?answer_token=%s' % (self.survey_id.access_token, self.access_token)
}
@api.model
@@ -150,7 +150,7 @@ class SurveyUserInput(models.Model):
Challenge = self.env['gamification.challenge'].sudo()
badge_ids = []
for user_input in self:
- if user_input.survey_id.certification and user_input.quizz_passed:
+ if user_input.survey_id.certification and user_input.scoring_success:
if user_input.survey_id.certification_mail_template_id and not user_input.test_entry:
user_input.survey_id.certification_mail_template_id.send_mail(user_input.id, notif_layout="mail.mail_notification_light")
if user_input.survey_id.certification_give_badge:
@@ -163,7 +163,7 @@ class SurveyUserInput(models.Model):
def get_start_url(self):
self.ensure_one()
- return '%s?answer_token=%s' % (self.survey_id.get_start_url(), self.token)
+ return '%s?answer_token=%s' % (self.survey_id.get_start_url(), self.access_token)
def get_print_url(self):
self.ensure_one()
diff --git a/addons/survey/static/src/js/survey_result.js b/addons/survey/static/src/js/survey_result.js
index c1d12963614..d2a6659f10e 100644
--- a/addons/survey/static/src/js/survey_result.js
+++ b/addons/survey/static/src/js/survey_result.js
@@ -255,7 +255,7 @@ publicWidget.registry.SurveyResultChart = publicWidget.Widget.extend({
},
_getDoughnutChartConfig: function () {
- var quizz_score = this.$el.data("quizz_score") || 0.0;
+ var scoring_percentage = this.$el.data("scoring_percentage") || 0.0;
var counts = this.graphData.map(function (point) {
return point.count;
});
@@ -277,7 +277,7 @@ publicWidget.registry.SurveyResultChart = publicWidget.Widget.extend({
options: {
title: {
display: true,
- text: _.str.sprintf(_t("Overall Performance %.2f%s"), parseFloat(quizz_score), '%'),
+ text: _.str.sprintf(_t("Overall Performance %.2f%s"), parseFloat(scoring_percentage), '%'),
},
}
};
diff --git a/addons/survey/tests/test_certification_flow.py b/addons/survey/tests/test_certification_flow.py
index 0e0b62fef99..e28c7a2f4a0 100644
--- a/addons/survey/tests/test_certification_flow.py
+++ b/addons/survey/tests/test_certification_flow.py
@@ -108,7 +108,7 @@ class TestCertificationFlow(common.TestSurveyCommon, HttpCase):
user_inputs = self.env['survey.user_input'].search([('survey_id', '=', certification.id)])
self.assertEqual(len(user_inputs), 1)
self.assertEqual(user_inputs.partner_id, self.user_emp.partner_id)
- answer_token = user_inputs.token
+ answer_token = user_inputs.access_token
# Employee begins survey with first page
response = self._access_page(certification, answer_token)
@@ -126,8 +126,8 @@ class TestCertificationFlow(common.TestSurveyCommon, HttpCase):
user_inputs.invalidate_cache()
# Check that certification is successfully passed
- self.assertEqual(user_inputs.quizz_score, 87.5)
- self.assertTrue(user_inputs.quizz_passed)
+ self.assertEqual(user_inputs.scoring_percentage, 87.5)
+ self.assertTrue(user_inputs.scoring_success)
# Check answer correction is taken into account
self.assertNotIn("I think they're great!", user_inputs.mapped('user_input_line_ids.value_free_text'))
diff --git a/addons/survey/tests/test_survey_flow.py b/addons/survey/tests/test_survey_flow.py
index a8b3023264e..45cea0332d3 100644
--- a/addons/survey/tests/test_survey_flow.py
+++ b/addons/survey/tests/test_survey_flow.py
@@ -75,7 +75,7 @@ class TestSurveyFlow(common.TestSurveyCommon, HttpCase):
# -> this should have generated a new answer with a token
answers = self.env['survey.user_input'].search([('survey_id', '=', survey.id)])
self.assertEqual(len(answers), 1)
- answer_token = answers.token
+ answer_token = answers.access_token
self.assertTrue(answer_token)
self.assertAnswer(answers, 'new', self.env['survey.question'])
diff --git a/addons/survey/views/res_partner_views.xml b/addons/survey/views/res_partner_views.xml
index d284039a8a5..604e5853b3f 100644
--- a/addons/survey/views/res_partner_views.xml
+++ b/addons/survey/views/res_partner_views.xml
@@ -5,7 +5,7 @@
<field name="name">Certifications Succeeded</field>
<field name="res_model">survey.user_input</field>
<field name="view_mode">tree</field>
- <field name="context">{'search_default_quizz_passed': 1}</field>
+ <field name="context">{'search_default_scoring_success': 1}</field>
</record>
<record id="res_partner_view_form" model="ir.ui.view">
diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml
index 30dfc0ca485..a4e046745ce 100644
--- a/addons/survey/views/survey_templates.xml
+++ b/addons/survey/views/survey_templates.xml
@@ -31,7 +31,7 @@
<span class="font-weight-bold text-danger" t-field="survey.time_limit" t-options="{'widget': 'duration', 'unit': 'minute'}"></span>
</p>
</div>
- <a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/fill/%s/%s' % (survey.access_token, answer.token)">
+ <a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/fill/%s/%s' % (survey.access_token, answer.access_token)">
<t t-if="survey.certification">
Start Certification
</t>
@@ -67,12 +67,12 @@
<t t-if="survey.questions_layout == 'page_per_question'" t-set="page_or_question_id" t-value="question.id" />
<form role="form" method="post" t-att-name="survey.id"
- t-att-data-answer-token="answer.token"
+ t-att-data-answer-token="answer.access_token"
t-att-data-survey-token="survey.access_token"
t-att-data-timer="answer.start_datetime.isoformat() if survey.is_time_limited else False"
t-att-data-time-limit-minutes="survey.time_limit">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
- <input type="hidden" name="token" t-att-value="answer.token" />
+ <input type="hidden" name="token" t-att-value="answer.access_token" />
<div class="o_survey_error alert alert-danger d-none" role="alert">
<p>Their was an error during the validation of the survey.</p>
</div>
diff --git a/addons/survey/views/survey_templates_management.xml b/addons/survey/views/survey_templates_management.xml
index 055915be91a..c2635e34cc4 100644
--- a/addons/survey/views/survey_templates_management.xml
+++ b/addons/survey/views/survey_templates_management.xml
@@ -81,8 +81,8 @@
<div class="row">
<div class="col">
<t t-if="survey.scoring_type != 'no_scoring'">
- <div>You scored <t t-esc="answer.quizz_score" />%</div>
- <t t-if="answer.quizz_passed">
+ <div>You scored <t t-esc="answer.scoring_percentage" />%</div>
+ <t t-if="answer.scoring_success">
<div>Congratulations, you have passed the test!</div>
<div t-if="survey.certification" class="mt16 mb16">
@@ -100,10 +100,10 @@
</t>
<t t-call="survey.survey_button_retake"/>
<div t-if="survey.scoring_type != 'scoring_without_answers'">
- If you wish, you can <a t-att-href="'/survey/print/%s?answer_token=%s&amp;review=True' % (survey.access_token, answer.token)">review your answers</a>
+ If you wish, you can <a t-att-href="'/survey/print/%s?answer_token=%s&amp;review=True' % (survey.access_token, answer.access_token)">review your answers</a>
</div>
</div>
- <div class="col-6 text-center" t-if="survey.certification_give_badge and answer.quizz_passed">
+ <div class="col-6 text-center" t-if="survey.certification_give_badge and answer.scoring_success">
<img t-att-src="'/web/image/gamification.badge/%s/image_128' % survey.certification_badge_id.id"/>
<div>You received the badge <span class="font-weight-bold" t-esc="survey.certification_badge_id.name"/>!</div>
</div>
@@ -112,7 +112,7 @@
</div>
<div class="container o_survey_result p-4" t-if="graph_data">
<div class="tab-content">
- <div role="tabpanel" class="tab-pane active survey_graph" t-att-data-quizz_score="answer.quizz_score" t-att-id="'graph_question_%d' % answer.id" t-att-data-question_id="answer.id" data-graph-type="doughnut" t-att-data-graph-data="graph_data">
+ <div role="tabpanel" class="tab-pane active survey_graph" t-att-data-scoring_percentage="answer.scoring_percentage" t-att-id="'graph_question_%d' % answer.id" t-att-data-question_id="answer.id" data-graph-type="doughnut" t-att-data-graph-data="graph_data">
<canvas id="doughnut_chart"></canvas>
<span class="o_overall_performance"></span>
</div>
@@ -138,17 +138,17 @@
<template id="survey_button_retake" name="Survey: retake button">
<div>
- <t t-if="not answer.quizz_passed">
+ <t t-if="not answer.scoring_success">
<t t-if="survey.is_attempts_limited">
<t t-set="attempts_left" t-value="survey._get_number_of_attempts_lefts(answer.partner_id, answer.email, answer.invite_token)" />
<t t-if="attempts_left > 0">
<p><span>Number of attemps left</span>: <span t-esc="attempts_left"></span></p>
- <p><a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/retry/%s/%s' % (survey.access_token, answer.token)">
+ <p><a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/retry/%s/%s' % (survey.access_token, answer.access_token)">
Retry</a></p>
</t>
</t>
<t t-else="">
- <p><a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/retry/%s/%s' % (survey.access_token, answer.token)">
+ <p><a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/retry/%s/%s' % (survey.access_token, answer.access_token)">
Retry</a></p>
</t>
</t>
diff --git a/addons/survey/views/survey_templates_statistics.xml b/addons/survey/views/survey_templates_statistics.xml
index 5e67ba98b1c..802f6908ffd 100644
--- a/addons/survey/views/survey_templates_statistics.xml
+++ b/addons/survey/views/survey_templates_statistics.xml
@@ -117,25 +117,25 @@
<tbody>
<t t-set="text_result" t-value="prepare_result"/>
<tr t-foreach="text_result" t-as="user_input">
- <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)"><t t-esc="user_input_index + 1"></t></a></td>
+ <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)"><t t-esc="user_input_index + 1"></t></a></td>
<t t-if="question.question_type == 'free_text'">
<td>
- <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)" t-field="user_input.value_free_text"></a><br/>
+ <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)" t-field="user_input.value_free_text"></a><br/>
</td>
</t>
<t t-if="question.question_type == 'textbox'">
<td>
- <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)" t-field="user_input.value_text"></a><br/>
+ <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)" t-field="user_input.value_text"></a><br/>
</td>
</t>
<t t-if="question.question_type == 'date'">
<td>
- <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)" t-field="user_input.value_date"></a><br/>
+ <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)" t-field="user_input.value_date"></a><br/>
</td>
</t>
<t t-if="question.question_type == 'datetime'">
<td>
- <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)" t-field="user_input.value_datetime"></a><br/>
+ <a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)" t-field="user_input.value_datetime"></a><br/>
</td>
</t>
</tr>
@@ -155,7 +155,7 @@
</thead>
<tbody>
<tr t-foreach="comments" t-as="user_input">
- <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)"><t t-esc="user_input_index + 1"></t></a></td>
+ <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)"><t t-esc="user_input_index + 1"></t></a></td>
<td>
<span t-field="user_input.value_text"></span><br/>
</td>
@@ -339,7 +339,7 @@
</thead>
<tbody>
<tr class="d-none" t-foreach="number_result['input_lines']" t-as="user_input">
- <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.token)"><t t-esc="user_input_index + 1"></t></a></td>
+ <td><a t-att-href="'/survey/print/%s?answer_token=%s' % (user_input.survey_id.access_token, user_input.user_input_id.access_token)"><t t-esc="user_input_index + 1"></t></a></td>
<td><span t-field="user_input.value_number"></span><br/></td>
</tr>
</tbody>
diff --git a/addons/survey/views/survey_user_views.xml b/addons/survey/views/survey_user_views.xml
index 4eb9f8d5b83..c2252f45871 100644
--- a/addons/survey/views/survey_user_views.xml
+++ b/addons/survey/views/survey_user_views.xml
@@ -14,7 +14,7 @@
<filter string="Partially Completed" name="partially_completed" domain="[('state', '=', 'skip')]"/>
<filter string="New" name="new" domain="[('state', '=', 'new')]"/>
<separator/>
- <filter string="Quizz passed" name="quizz_passed" domain="[('quizz_passed','=', True)]"/>
+ <filter string="Quizz passed" name="scoring_success" domain="[('scoring_success','=', True)]"/>
<separator/>
<filter string="Test Entries" name="test" domain="[('test_entry','=', True)]"/>
<filter string="Except Test Entries" name="not_test" domain="[('test_entry','=', False)]" invisible="1"/>
@@ -45,13 +45,13 @@
<field name="survey_id"/>
<field name="create_date"/>
<field name="is_attempts_limited" invisible="1"/>
- <label for="attempt_number" string="Attempt n°" attrs="{'invisible': ['|', ('is_attempts_limited', '=', False), '|', ('test_entry', '=', True), ('state', '!=', 'done')]}"/>
+ <label for="attempts_number" string="Attempt n°" attrs="{'invisible': ['|', ('is_attempts_limited', '=', False), '|', ('test_entry', '=', True), ('state', '!=', 'done')]}"/>
<div attrs="{'invisible': ['|', ('is_attempts_limited', '=', False), '|', ('test_entry', '=', True), ('state', '!=', 'done')]}">
- <field name="attempt_number" nolabel="1"/>
+ <field name="attempts_number" nolabel="1"/>
/
<field name="attempts_limit" nolabel="1" />
</div>
- <field name="token" groups="base.group_no_one"/>
+ <field name="access_token" groups="base.group_no_one"/>
</group>
<group>
<field name="deadline"/>
@@ -59,8 +59,8 @@
<field name="email" widget="email"/>
<field name="test_entry" groups="base.group_no_one"/>
<field name="scoring_type" invisible="1"/>
- <field name="quizz_score" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}"/>
- <field name="quizz_passed" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}"/>
+ <field name="scoring_percentage" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}"/>
+ <field name="scoring_success" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}"/>
</group>
</group>
<field name="user_input_line_ids" mode="tree" attrs="{'readonly': False}">
@@ -90,11 +90,11 @@
<field name="deadline"/>
<field name="partner_id"/>
<field name="email"/>
- <field name="attempt_number" />
+ <field name="attempts_number"/>
<field name="state"/>
<field name="test_entry" invisible="True"/>
- <field name="quizz_passed"/>
- <field name="quizz_score"/>
+ <field name="scoring_success"/>
+ <field name="scoring_percentage"/>
</tree>
</field>
</record>
diff --git a/addons/website_slides_survey/controllers/slides.py b/addons/website_slides_survey/controllers/slides.py
index 3c8f7bdc4ec..bd7f34349be 100644
--- a/addons/website_slides_survey/controllers/slides.py
+++ b/addons/website_slides_survey/controllers/slides.py
@@ -65,8 +65,8 @@ class WebsiteSlides(WebsiteSlides):
partner_ids = [user.partner_id.id for user in users]
domain = [
('slide_partner_id.partner_id', 'in', partner_ids),
- ('quizz_passed', '=', True),
- ('slide_partner_id.survey_quizz_passed', '=', True)
+ ('scoring_success', '=', True),
+ ('slide_partner_id.survey_scoring_success', '=', True)
]
certificates = request.env['survey.user_input'].sudo().search(domain)
users_certificates = {
diff --git a/addons/website_slides_survey/data/gamification_data.xml b/addons/website_slides_survey/data/gamification_data.xml
index ea7153b796f..fc05b0ba125 100644
--- a/addons/website_slides_survey/data/gamification_data.xml
+++ b/addons/website_slides_survey/data/gamification_data.xml
@@ -5,7 +5,7 @@
</record>
<record id="website_slides.badge_data_certification_goal" model="gamification.goal.definition">
<field name="domain">[
- ('survey_quizz_passed', '=', True),
+ ('survey_scoring_success', '=', True),
('slide_id.slide_type', '=', 'certification')
]</field>
</record>
diff --git a/addons/website_slides_survey/models/slide_slide.py b/addons/website_slides_survey/models/slide_slide.py
index b3844550130..26b79394c58 100644
--- a/addons/website_slides_survey/models/slide_slide.py
+++ b/addons/website_slides_survey/models/slide_slide.py
@@ -8,29 +8,29 @@ class SlidePartnerRelation(models.Model):
_inherit = 'slide.slide.partner'
user_input_ids = fields.One2many('survey.user_input', 'slide_partner_id', 'Certification attempts')
- survey_quizz_passed = fields.Boolean('Certification Quizz Passed', compute='_compute_survey_quizz_passed', store=True)
+ survey_scoring_success = fields.Boolean('Certification Succeeded', compute='_compute_survey_scoring_success', store=True)
- @api.depends('partner_id', 'user_input_ids.quizz_passed')
- def _compute_survey_quizz_passed(self):
- passed_user_inputs = self.env['survey.user_input'].sudo().search([
+ @api.depends('partner_id', 'user_input_ids.scoring_success')
+ def _compute_survey_scoring_success(self):
+ succeeded_user_inputs = self.env['survey.user_input'].sudo().search([
('slide_partner_id', 'in', self.ids),
- ('quizz_passed', '=', True)
+ ('scoring_success', '=', True)
])
- passed_slide_partners = passed_user_inputs.mapped('slide_partner_id')
+ succeeded_slide_partners = succeeded_user_inputs.mapped('slide_partner_id')
for record in self:
- record.survey_quizz_passed = record in passed_slide_partners
+ record.survey_scoring_success = record in succeeded_slide_partners
@api.model_create_multi
def create(self, vals_list):
res = super(SlidePartnerRelation, self).create(vals_list)
- completed = res.filtered('survey_quizz_passed')
+ completed = res.filtered('survey_scoring_success')
if completed:
completed.write({'completed': True})
return res
def _write(self, vals):
res = super(SlidePartnerRelation, self)._write(vals)
- if vals.get('survey_quizz_passed'):
+ if vals.get('survey_scoring_success'):
self.sudo().write({'completed': True})
return res
diff --git a/addons/website_slides_survey/models/survey_user.py b/addons/website_slides_survey/models/survey_user.py
index 9824bf78bc7..f19aaa4d610 100644
--- a/addons/website_slides_survey/models/survey_user.py
+++ b/addons/website_slides_survey/models/survey_user.py
@@ -38,7 +38,7 @@ class SurveyUserInput(models.Model):
user_inputs = self.search([
('id', 'in', self.ids),
('state', '=', 'done'),
- ('quizz_passed', '=', False),
+ ('scoring_success', '=', False),
('slide_partner_id', '!=', False)
])
diff --git a/addons/website_slides_survey/tests/test_course_certification_failure.py b/addons/website_slides_survey/tests/test_course_certification_failure.py
index 1876ff8f6ae..1487fb2eea0 100644
--- a/addons/website_slides_survey/tests/test_course_certification_failure.py
+++ b/addons/website_slides_survey/tests/test_course_certification_failure.py
@@ -68,7 +68,7 @@ class TestCourseCertificationFailureFlow(TestSurveyCommon):
# Step 4: fill in the created user_input with wrong answers
self.fill_in_answer(slide_partner.user_input_ids[0], certification.question_ids)
- self.assertFalse(slide_partner.survey_quizz_passed, 'Quizz should not be marked as passed with wrong answers')
+ self.assertFalse(slide_partner.survey_scoring_success, 'Quizz should not be marked as passed with wrong answers')
# forces recompute of partner_ids as we delete directly in relation
self.channel.invalidate_cache()
self.assertIn(self.user_public.partner_id, self.channel.partner_ids, 'Public user should still be a member of the course because he still has attempts left')
@@ -100,7 +100,7 @@ class TestCourseCertificationFailureFlow(TestSurveyCommon):
# Step 8: fill in the created user_input with correct answers this time
self.fill_in_answer(new_slide_partner.user_input_ids.filtered(lambda user_input: user_input.state != 'done')[0], certification.question_ids, good_answers=True)
- self.assertTrue(new_slide_partner.survey_quizz_passed, 'Quizz should be marked as passed with correct answers')
+ self.assertTrue(new_slide_partner.survey_scoring_success, 'Quizz should be marked as passed with correct answers')
# forces recompute of partner_ids as we delete directly in relation
self.channel.invalidate_cache()
self.assertIn(self.user_public.partner_id, self.channel.partner_ids, 'Public user should still be a member of the course')
diff --git a/addons/website_slides_survey/views/website_profile.xml b/addons/website_slides_survey/views/website_profile.xml
index 8a76d0867e3..0679be859de 100644
--- a/addons/website_slides_survey/views/website_profile.xml
+++ b/addons/website_slides_survey/views/website_profile.xml
@@ -21,7 +21,7 @@
<div class="p-2 w-100">
<h5 class="mt-0 mb-1" t-esc="certificate.survey_id.title"/>
<div t-if="user.id == uid">
- <small class="font-weight-bold">Score : <span t-esc="certificate.quizz_score"/> %</small>
+ <small class="font-weight-bold">Score : <span t-esc="certificate.scoring_percentage"/> %</small>
<div class="float-right">
<a role="button" class="float-right" t-att-href="'/survey/%s/get_certification' % certificate.survey_id.id">
<i class="fa fa-download" aria-label="Download certification" title="Download Certification"/>