Relationship Graph

Relationship Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
11733Bug reportsExpression Managerpublic2020-03-13 18:46
Reporterecoutinho Assigned ToLouisGac 
PrioritynormalSeverityminor 
Status closedResolutionreopened 
Product Version2.52.x 
Summary11733: Multiple Choice: 'Please check at least one item' helper when minimum is two
Description

On a mandatory multiple choice question configured for two minimum answers, if you don't select any, you get conflicting help messages:
Please select at least 2 answers
Please check at least one item.

Steps To Reproduce

Create a Multiple Choice Question
Make it Mandatory
Set Minimum answers: 2
Don't choose any answer, and press Next

Additional Information

On application/helpers/expressions/em_manager_helper.php, this code should also check the minimum answers:

if (!($qInfo['type'] == '!' || $qInfo['type'] == 'L')) {
$sMandatoryText = $LEM->gT('Please check at least one item.');

TagsNo tags attached.
Attached Files
multiple_choice.PNG (12,597 bytes)   
multiple_choice.PNG (12,597 bytes)   
2.57_system.png (14,401 bytes)   
2.57_system.png (14,401 bytes)   
Bug heat10
Complete LimeSurvey version number (& build)2.52+160920
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmariadb-5.5.50-1.el7_2.x86_64
Server OS (if known)Linux CentOS
Webserver software & version (if known)Apache 2.4.6
PHP Version5.4.16

Activities

ollehar

ollehar

2016-10-04 12:35

administrator   ~41083

Can reproduce.

Do we even need the message "Please check at least one item". It's not enough to have it show that it's mandatory?

ecoutinho

ecoutinho

2016-10-04 13:10

reporter   ~41090

I think the message would be necessary if the question was not set up as mandatory, but with a minimum of one item.

ecoutinho

ecoutinho

2016-10-04 13:30

reporter   ~41093

Further tests show that in this last scenario, it already presents the message 'Please select at least one answer', so the message 'Please check at least one item' is not necessary.

Nevertheless, please notice that these tests were on a multiple choice question, but that 'if' statement is applied to every question, whose type is neither '!' nor 'L'. So, the message might be needed on other question types. It would be safer to check the minimum answers and produce a message which takes that number into account.

ollehar

ollehar

2016-10-14 12:51

administrator   ~41349

One way to solve this is to query about question information in _ValidateQuestion, to see if there is a minimum number of answers. I'm not convinced I want to make that change - EM is cluttery enough. Any other ideas?

ecoutinho

ecoutinho

2016-10-14 16:18

reporter   ~41357

You could also exclude case 'M' from printing the message. Or better yet, include only 'P', as is the one that is left:

if ($qInfo['type'] == 'P')
{
$sMandatoryText = $LEM->gT('Please check at least one item.');

ollehar

ollehar

2016-10-14 16:30

administrator   ~41358

There could be a situation where the question is mandatory but there is no specific limit on how many. So the code has to check which message to choose.

LouisGac

LouisGac

2016-12-09 17:04

developer   ~42505

https://bugs.limesurvey.org/view.php?id=11867

DenisChenu

DenisChenu

2016-12-10 18:32

developer   ~42516

We redo some issue now ;).

I think we must remove the 'default tip' in some condition.

The old system are here :https://github.com/LimeSurvey/LimeSurvey/blob/2.06lts/application/helpers/qanda_helper.php#L171
(and now, i understand why we lost this part $question_text['help'] = "default static tip".

2 solution :
1.

  • Set default without condition
  • unset default after
    2.
  • Set default under condition

Think 1. is better when we move all this system to specific Question(model|attribute) wher another attrivute can updarte string of another attribute.

I can do it for 2.5X on 3.0 only if you want.

LouisGac

LouisGac

2016-12-12 10:09

developer   ~42519

Denis, you're the one with the most experience of the Expression Manager, so if you think 1 is better, let's go for one.

I like 2, because it kept everything in a single logic, and it "would" probably make refactorisation easier. But we're not here for now.

I have only one question: you reopened this bug, but for me, it seems resolved in 2.50 with the fix of #11867, did you reopen only to leave the note, or does this bug still happen?

Else, if it's fixed it 2.50, we can let it like that. In 3.0, use solution 1 if you want.

I'd like to move to twig today, so I prefer not spend to much time in redoing debugging again and again.

DenisChenu

DenisChenu

2016-12-12 10:42

developer   ~42520

I reopen the bug : because original bug is :

Multiple choice show 2 errors
Please select at least 2 answers
Please check at least one item.

Actual bug is
Please check one or more item (default)
Please select at least 2 answers (minimal count)

Then the original bug happen again now with just some difference in sentence.

:).

OK for 2 , but really unsure for refactorisation .

LouisGac

LouisGac

2016-12-12 11:20

developer   ~42521

I think I cheked Denis, and it's no more showing "Please check at least one item.
" when there is "Please select at least 2 answers"

Also... that was before we changed eqn to 1 for default

DenisChenu

DenisChenu

2016-12-12 11:39

developer   ~42522

See https://bugs.limesurvey.org/file_download.php?file_id=8790&type=bug

LouisGac

LouisGac

2016-12-12 11:41

developer   ~42523

ok so it's the "eqn => 1" that did it again.
so, first solution is best solution to solve it the easy way.

DenisChenu

DenisChenu

2016-12-13 08:46

developer   ~42527

Just about refactorisation :

  • If 'default' (always from core) must test extra attribute : the extra attribute must have a settings for this (replacedefault=>true ?)
    or
  • extra attribute can update another attribute (or only default ?)

:) ....

Always hard to find the best way.
For 2.5X : we can just copy/paste the old behaviour : default test max_answers and min_answers

c_schmitz

c_schmitz

2020-03-13 18:46

administrator   ~56455

This version of LimeSurvey is not longer supported. Please check so that the issue is fixed in a more recent version of LimeSurvey. If it's not, please reopen this bug report. Thank you.

Issue History

Date Modified Username Field Change
2016-09-30 18:21 ecoutinho New Issue
2016-09-30 18:21 ecoutinho File Added: limesurvey_survey_531176.lss
2016-09-30 18:23 ecoutinho File Added: multiple_choice.PNG
2016-10-04 12:35 ollehar Note Added: 41083
2016-10-04 13:10 ecoutinho Note Added: 41090
2016-10-04 13:30 ecoutinho Note Added: 41093
2016-10-14 12:34 ollehar Assigned To => ollehar
2016-10-14 12:34 ollehar Status new => assigned
2016-10-14 12:51 ollehar Note Added: 41349
2016-10-14 12:51 ollehar Priority none => normal
2016-10-14 12:52 ollehar Assigned To ollehar =>
2016-10-14 12:52 ollehar Status assigned => new
2016-10-14 12:52 ollehar Status new => acknowledged
2016-10-14 16:18 ecoutinho Note Added: 41357
2016-10-14 16:30 ollehar Note Added: 41358
2016-12-09 17:04 LouisGac Assigned To => LouisGac
2016-12-09 17:04 LouisGac Status acknowledged => resolved
2016-12-09 17:04 LouisGac Resolution open => fixed
2016-12-09 17:04 LouisGac Note Added: 42505
2016-12-10 18:32 DenisChenu Status resolved => feedback
2016-12-10 18:32 DenisChenu Resolution fixed => reopened
2016-12-10 18:32 DenisChenu Note Added: 42516
2016-12-10 18:33 DenisChenu File Added: 2.57_system.png
2016-12-12 10:09 LouisGac Note Added: 42519
2016-12-12 10:42 DenisChenu Note Added: 42520
2016-12-12 11:20 LouisGac Note Added: 42521
2016-12-12 11:39 DenisChenu Note Added: 42522
2016-12-12 11:41 LouisGac Note Added: 42523
2016-12-13 08:46 DenisChenu Note Added: 42527
2020-03-13 18:46 c_schmitz Note Added: 56455
2020-03-13 18:46 c_schmitz Status feedback => closed