Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
16776Bug reportsSurvey takingpublic2021-03-06 10:39
ReporterMazi Assigned Togabrieljenik  
PrioritynoneSeverityblock 
Status closedResolutionfixed 
Product Version4.3.22 
Fixed in Version4.4.7 
Summary16776: Question index marks pages with fully answered questions as unanswered
Description

When answering all questions of page 1 at the attached sample survey and then clicking next, that groups is still makred as unanswered at the question index on page 2, see attached screenshot.

Steps To Reproduce

Import an dactivate the attached survey.
Run the survey, fill in all details at page 1.
Check the question index at page 2 -> the previous group is still marked as unanswered.

Additional Information

This is an URGENT issue for us since the customer wants to go live at the end of the month.

I can reproduce the issue with shipped and custom template so it may not be a template issue but be related to the survey engine and marking pages as completed.

TagsNo tags attached.
Attached Files
index_error.png (61,135 bytes)   
index_error.png (61,135 bytes)   
Bug heat6
Complete LimeSurvey version number (& build)Version 4.3.22+201019
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMySQL 5
Server OS (if known)Ubuntu 18
Webserver software & version (if known)Apache
PHP Version7.3

Relationships

related to 15892 closedollehar List with comment isn't marked as answered if comment is missing 

Activities

Mazi

Mazi

2020-10-22 14:39

updater   ~60363

@cdorin, can you have a look and if you can reproduce, maybe assign it to @gabrieljenik directly since he is also involved at this project?

gabrieljenik

gabrieljenik

2020-10-27 14:29

manager   ~60425

This is the code that checks if a SQ is unanswered.

////////////////////////////////////////////////////////////////////
            // WHICH RELEVANT, VISIBLE (SUB)-QUESTIONS HAVEN'T BEEN ANSWERED? //
            ////////////////////////////////////////////////////////////////////
            // check that all mandatories have been fully answered (but don't require answers for subquestions that are irrelevant
            $unansweredSQs = array();   // list of subquestions that weren't answered
            foreach ($relevantSQs as $sgqa)
            {
                if (($qInfo['type'] != Question::QT_ASTERISK_EQUATION) && (!isset($_SESSION[$LEM->sessid][$sgqa]) || ($_SESSION[$LEM->sessid][$sgqa] === '' || is_null($_SESSION[$LEM->sessid][$sgqa]))))
                {
                    // then a relevant, visible, mandatory question hasn't been answered
                    // Equations are ignored, since set automatically
                    $unansweredSQs[] = $sgqa;
                }
            }

A SQ is marked as unanswered if the question is null or blank.
As the SQ are checkboxes, if none is checked, all are saved as blank in the DB.

The question here is: blanks mean unanswered?
If so, I think there could be a lot to change as I think that is taken into consideration for many other question types.

Put in other words, @Mazi, when do you expect a question should be marked unanswered?
When there is no value or when it hasn't been processed? (unseen)

Mazi

Mazi

2020-10-27 14:42

updater   ~60426

Thanks for debugging this, @gabrieljenik.

I think your question is difficult to answer. My first guess would be "a single answer at each row". But for other setup it could be for each column or for the whole question. Hard to tell.
Questions which were skipped should surely not be treated as unanswered since the user never had a chance to answer them.

gabrieljenik

gabrieljenik

2020-10-27 15:44

manager   ~60429

Questions which were skipped should surely not be treated as unanswered since the user never had a chance to answer them.
You are talking about relevance, right?

Mazi

Mazi

2020-10-27 21:05

updater   ~60431

Correct, relevance/conditions. Usually there should be a difference between NULL and empty values at the DB. One of them was for indicating skipped questions the other for unanswered questions.

gabrieljenik

gabrieljenik

2020-10-27 23:42

manager   ~60432

I think that's being taken care: skipped questions shouldn't count as unanswered.
Still, by the situation you describe on the description of the bug, it seem your example expects that empty shouldn't count for unanswered.
Am I right?

Mazi

Mazi

2020-10-28 08:32

updater   ~60433

Yes, I think assuming that for a multi choice question or even an array of checkboxes, we should not assume that every single checkbox has to be checked before we treat that question as answered. That would be a little too much.
@c_schmitz, what's your opinion on this?

DenisChenu

DenisChenu

2020-10-28 09:48

developer   ~60434

Last edited: 2020-10-28 09:48

My opinion :

skipped questions shouldn't count as unanswered.

+1

we should not assume that every single checkbox has to be checked before we treat that question as answered.

+1 for multiple choice and multiple choice with comment
Unsure for array or multiple text
Unsure for array of text + array of number

gabrieljenik

gabrieljenik

2020-10-28 13:45

manager   ~60442

I think we need to go to the roots:

  • What un-amswered should reflect?
  • What's the feature for? How the user will take advantage from it?

From there:

  • Mandatory questions not answered should count as aunanswered?
  • Empty not mandatory answers?
    • Empty text boxes?
    • Non checked checkboxes?

From the code, I think "unaswered" means empty responses.
I am not sure how usefull is for participants.

DenisChenu

DenisChenu

2020-10-28 14:27

developer   ~60445

I think we need to go to the roots:

Maybe : «if this question was mandatory it was invalid»

This mean : all array answered, checkbox count > 1 . I don't know for checkbox with comment.

Mazi

Mazi

2020-11-04 08:50

updater   ~60528

Summing up yesterday's DEV meeting, most people recommend treating question as completed as follows:
a) multi choice: at least a single checkbox was checked
b) array of checkboxes: at least a single checkbox was checked at every row

@c_schmitz, what do you think? Should it be implemented it like this?

DenisChenu

DenisChenu

2020-11-04 09:03

developer   ~60529

See https://github.com/LimeSurvey/LimeSurvey/blob/70f326fc531004d046a434b953d3040dc0f67a20/application/helpers/expressions/em_manager_helper.php#L6663

Not answered must follow mandatory rules …

gabrieljenik

gabrieljenik

2020-11-04 15:18

manager   ~60537

@Mazi, I missed yeterday's debate. Sorry.
On the situation that you are saying:

  • If there is a list of diseases where you need to check the ones that you had.
  • If you are healthy and don't check any of those, the question will be marked as "unanswered" ?

I feel the current behaviour is OK as it is: Those checkboxes are marked as answered.

A new example:

  • We replace the disease checkboxes by yes/no radio buttons with default in NO.
  • A healthy person will still go through the question, will not change any default and click submit.
  • That question will be treated as answered.

So, the dilema is: A non selected checkbox counts as answered? I think yes.

Mazi

Mazi

2020-11-04 16:07

updater   ~60539

@gabrieljenik, as for the diseases example: That looks correct. If a checkbox was checked the question should be treated as answered, otherwise not.
Usually in this case one should have an "I am healthy" option as well which should also be marked as exclusive option, but that is another topic.

We should NOT add any code to replace a checkbox by radio buttons with yes/no labels. That would be a huge change.

DenisChenu

DenisChenu

2020-11-04 16:10

developer   ~60540

Then : there are no issue finally ?

Mazi

Mazi

2020-11-04 17:23

updater   ~60543

THere still is an issue. For the array with checkboxes the question onyl gets treated as completed if ALL (!) checkboxes are checked. That's surely wrong.

DenisChenu

DenisChenu

2020-11-04 18:42

developer   ~60544

OK :)

Array number + options checkbox :

Specific in https://github.com/LimeSurvey/LimeSurvey/blob/70f326fc531004d046a434b953d3040dc0f67a20/application/helpers/expressions/em_manager_helper.php#L6728

gabrieljenik

gabrieljenik

2020-11-04 21:57

manager   ~60547

That looks correct. If a checkbox was checked the question should be treated as answered, otherwise not.

Actually I meant the other way arround. If non checkbox is checked, still, that should be treated as answered.
That is, I believe, the current behaviour.

We should NOT add any code to replace a checkbox by radio buttons with yes/no labels. That would be a huge change.

Agree. It was an example of how checkbox compares to radio button.
Checkbox = Radio button with default answer.

For the array with checkboxes the question onyl gets treated as completed if ALL (!) checkboxes are checked

OK. Let me pickup on this specific part of the bug then.

gabrieljenik

gabrieljenik

2020-11-05 20:35

manager   ~60571

@DenisChenu @Mazi What if we add a new case type in this line?
https://github.com/LimeSurvey/LimeSurvey/blob/70f326fc531004d046a434b953d3040dc0f67a20/application/helpers/expressions/em_manager_helper.php#L6816

For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered.
If not, we flag it as anunserwed.

What do you think?

I think this is the first part of a broader solution for other quesiton types, but let's start with this small change.
What do you think?

DenisChenu

DenisChenu

2020-11-06 08:29

developer   ~60575

@gabrieljenik : it seems it does that for multiple checkbox, then : yes : seems a good idea :)

gabrieljenik

gabrieljenik

2020-11-12 15:25

manager   ~60625

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1652

I guess we all agree that code needs major refactroning, right? :)

DenisChenu

DenisChenu

2020-11-12 15:29

developer   ~60627

Like WHOLE ExpressionManager ;)

gabrieljenik

gabrieljenik

2020-12-10 17:58

manager   ~60922

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30783

Related Changesets

LimeSurvey: master 4f0bb4e3

2020-12-10 17:55:54

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16776 question index marks pages with fully answered questions as unanswered (#1652)

* Fixed issue 16776: Question index marks pages with fully answered questions as unanswered

For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered. If not, we flag it as anunserwed.

* Fixed issue 16776: Question index marks pages with fully answered questions as unanswered

For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered. If not, we flag it as anunserwed.

* Fixed issue 16776: Question index marks pages with fully answered questions as unanswered

Dummy change to trigger travis
Affected Issues
16776
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2020-10-22 14:39 Mazi New Issue
2020-10-22 14:39 Mazi File Added: limesurvey_survey_698548-question-index-problem.lss
2020-10-22 14:39 Mazi File Added: index_error.png
2020-10-22 14:39 Mazi Note Added: 60363
2020-10-23 19:02 cdorin Assigned To => gabrieljenik
2020-10-23 19:02 cdorin Status new => assigned
2020-10-27 14:29 gabrieljenik Note Added: 60425
2020-10-27 14:42 Mazi Note Added: 60426
2020-10-27 15:44 gabrieljenik Note Added: 60429
2020-10-27 21:05 Mazi Note Added: 60431
2020-10-27 23:42 gabrieljenik Note Added: 60432
2020-10-28 08:32 Mazi Note Added: 60433
2020-10-28 09:48 DenisChenu Note Added: 60434
2020-10-28 09:48 DenisChenu Note Edited: 60434
2020-10-28 13:45 gabrieljenik Note Added: 60442
2020-10-28 14:27 DenisChenu Note Added: 60445
2020-11-04 08:50 Mazi Note Added: 60528
2020-11-04 09:03 DenisChenu Note Added: 60529
2020-11-04 15:18 gabrieljenik Note Added: 60537
2020-11-04 16:07 Mazi Note Added: 60539
2020-11-04 16:10 DenisChenu Note Added: 60540
2020-11-04 17:23 Mazi Note Added: 60543
2020-11-04 18:42 DenisChenu Note Added: 60544
2020-11-04 21:57 gabrieljenik Note Added: 60547
2020-11-05 20:35 gabrieljenik Note Added: 60571
2020-11-06 08:29 DenisChenu Note Added: 60575
2020-11-12 15:25 gabrieljenik Note Added: 60625
2020-11-12 15:29 DenisChenu Note Added: 60627
2020-12-10 17:58 gabrieljenik Changeset attached => LimeSurvey master 4f0bb4e3
2020-12-10 17:58 gabrieljenik Note Added: 60922
2020-12-10 17:58 gabrieljenik Resolution open => fixed
2021-03-03 16:11 ollehar Status assigned => closed
2021-03-03 16:11 ollehar Fixed in Version => 4.4.7
2021-03-06 10:39 DenisChenu Relationship added related to 15892