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
10055Feature requestsExpression Managerpublic2018-11-01 16:22
ReporterMazi Assigned ToLouisGac 
PrioritynormalSeverityfeature 
Status assignedResolutionopen 
Summary10055: Hide question if all sub-questions are hidden.
Description

LS 2.06 offers the great feature of hiding sub-questions conditionally. Unfortunately, if all sub-questions of a certain question are hidden by conditions, the question still shows up but without any items.

Steps To Reproduce

Take any error question and enter "0" at the relevance field for each sub-question.

Additional Information

While groups at which all questions are hidden are automatically skipped by Limesurvey, this doesn't apply to questions at which all sub-questions are hidden.
It would be great to have the same behavior on question level.

Tagsanswers_html
Bug heat10
Story point estimate
Users affected %

Relationships

related to 11692 closedDenisChenu Feature requests Remove the display:none for EM filter (and condition) : use hidden, ls-hidden 
related to 12162 closed Bug reports relevanceStatus not available for every question e.g. arrays. 

Activities

DenisChenu

DenisChenu

2015-11-23 14:32

developer   ~33619

We don't have a FR for array_filter ?

More for 2.5 or 3.0 than 2.06 i think
PS: did you try count(that.relevanceStatus) for relevance equation ?

Mazi

Mazi

2015-11-23 15:34

updater   ~33620

Denis, I tested several different approaches using COUNT or SUM and SELF or THAT but none worked.

DenisChenu

DenisChenu

2015-11-23 16:08

developer   ~33621

Seems self.relevanceStatus is javascript OK, but not relevance OK ...

DenisChenu

DenisChenu

2015-12-01 14:33

developer   ~33641

I'm silly :

QQ_Subq.relevanceStatus == (QQ_Subq.relevance && QQ.relevanceStus)

Buggy here ... with relevanceStatus ....

DenisChenu

DenisChenu

2016-11-06 19:45

developer   ~41736

Can be done in event.

But : template related ? Adding it in a new function OR core related : adding it in existing function.

Start by adding it to template

DenisChenu

DenisChenu

2016-11-06 19:46

developer   ~41737

... Only for 'view'/css/js : not for PHP.

Touch this is more complex in EM

DenisChenu

DenisChenu

2016-11-08 01:59

developer   ~41766

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

DenisChenu

DenisChenu

2016-11-08 02:01

developer   ~41767

Fixed in js in default template . Reopen for PHP/QUestion by question mode (or only one question in such group).

Is linked with another issue : .relevanceStaus for sub question + .relevance must give direct equation relevance (not group.relevance && question.relevance if i remind).

LouisGac

LouisGac

2016-11-14 15:52

developer   ~41895

"Reopen for PHP/QUestion by question mode"

I bet it's going to be pretty hard. Do you yet have any idea about how to proceed?

DenisChenu

DenisChenu

2016-11-14 16:42

developer   ~41908

Last edited: 2016-11-14 16:42

@LouisGac : yes.
1st : Create or look at QCODE_SQ1.relevance for subquestion : think it was broken actually (return NaN for subquestion)
2st : we must have a .relevanceEquation : return the equation for 'all' sub question

When we have it:
Find where to put :
Question.relevance = Question.relevanceEquation AND count (self.relevanceEquation) > 0.

Need a lot of work and testing

LouisGac

LouisGac

2016-11-18 14:50

developer   ~42063

I think this could be useful, in SurveyRuntimeHelper:

if (isset($moveResult)){
$_SESSION[$LEMsessid]['step'] = $moveResult['seq'] + 1; // step is index base 1?

        }
DenisChenu

DenisChenu

2016-11-18 15:03

developer   ~42064

@LouiGac : linked with this feature ?

If i remind step is 0 indexed, and -1 is for "welcome page"

DenisChenu

DenisChenu

2016-11-18 15:08

developer   ~42065

Last edited: 2016-11-18 15:08

PS : about this issue :
WWe can "easily" add the expression :
count(QCODE_SQ001.relevanceEquation,....) > 0

But really : i don't think we must show it in Expresssion Manager file.

An alterantive solution can be :

  • Test if previewMode is set and is ==='logic'
    => Add the test only if we are not in "survey logic file system"
    (or export, or .....)

See https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/expressions/em_manager_helper.php#L66
and
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/expressions/em_manager_helper.php#L9165

DenisChenu

DenisChenu

2016-11-19 01:09

developer   ~42069

@LouisGac maybe i can take a look next week : you work on twig next week ? If yes : i give it a try (working on EM mmmm !)

jelo

jelo

2017-02-28 17:37

partner   ~43105

Is that issue fixed / feature added?

DenisChenu

DenisChenu

2017-02-28 17:42

developer   ~43106

Currently : done for javascript in develop for default template : https://github.com/LimeSurvey/LimeSurvey/blob/develop/application/core/packages/template-default/template-core.js#L95

Really more hard to have a clean way in EM currently (relevanceStatus and relevance is broken)

ANd : if it's not set 'fixed' => it's not fixed

LouisGac

LouisGac

2017-03-02 10:37

developer   ~43117

this bug will be very easy to fix in the twig, so I suggest to leave it as it is in 2.50.
see:

https://github.com/LimeSurvey/LimeSurvey/blob/twig-layout/templates/default/views/question.twig

DenisChenu

DenisChenu

2017-03-02 10:42

developer   ~43118

Last edited: 2017-03-02 10:43

Easy to fix in HTML : OK : "fix it if there other question in same page" .

BUT : this don't fix question by question mode .... if you have a question with all subquestion hidden : the 'step' still valid.

Current develop default template fix it too ....

LouisGac

LouisGac

2017-03-02 10:47

developer   ~43120

well, that's should be a fix in the next step calculation.

DenisChenu

DenisChenu

2017-03-02 10:51

developer   ~43121

<autoquote> Touch this is more complex in EM </autoquote> and step are managed by EM currently

LouisGac

LouisGac

2017-03-02 11:01

developer   ~43122

something like this:

in SurveyRuntime Helper, here:
https://github.com/LimeSurvey/LimeSurvey/blob/twig-layout/application/helpers/SurveyRuntimeHelper.php#L1012

if ( question by question mode && all subquestion hidde )
LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['totalsteps'] + 1, false)

LouisGac

LouisGac

2017-03-02 11:08

developer   ~43123

Denis: I've just seen your comment about EM. I trend to consider SurveyRuntime as a controller and EM as a model.
That's why I think those kind of calculations should rather be in SurveyRuntime.

To be more accurate, I bet that piece of pseudo code should work:

Right now we have:
https://github.com/LimeSurvey/LimeSurvey/blob/twig-layout/application/helpers/SurveyRuntimeHelper.php#L1011-L1013

        if ( $move == &quot;movenext&quot;){
            $moveResult = $this->moveResult = LimeExpressionManager::NavigateForwards();
        }

I think we should have:

        if ( $move == &quot;movenext&quot;){
            if ( question by question mode && all subquestion hidde ){
                $moveResult = $this->moveResult = LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['totalsteps'] + 1, false);
            }else{
                $moveResult = $this->moveResult = LimeExpressionManager::NavigateForwards();
            }
        }
jelo

jelo

2018-01-25 22:24

partner   ~46103

Still relevant for LS 3.X? Subquestion relevance and array filter can end with everything hide.

DenisChenu

DenisChenu

2018-11-01 16:22

developer   ~49503

@jelo : template-core.js have a solution for this. The real only issue (must) be in question by question mode.

I put must because : not tested since 3.X (not RC) release mean not really fixed (a lot of update are done in HTML and JS after answers_html work)

Related Changesets

LimeSurvey: answers_html b15dba57

2016-11-08 01:58:32

DenisChenu

Details Diff
New feature 10055: Hide question if all sub-questions are hidden (partial : not for question by question mode)
Dev: core or template issue ?
Affected Issues
10055
mod - application/core/packages/limesurvey/survey.js Diff File
mod - templates/default/scripts/template.js Diff File
mod - templates/default/views/endpage.pstpl Diff File

Issue History

Date Modified Username Field Change
2015-11-23 14:01 Mazi New Issue
2015-11-23 14:01 Mazi Status new => assigned
2015-11-23 14:01 Mazi Assigned To => DenisChenu
2015-11-23 14:31 DenisChenu Assigned To DenisChenu =>
2015-11-23 14:31 DenisChenu Project Bug reports => Feature requests
2015-11-23 14:32 DenisChenu Note Added: 33619
2015-11-23 14:32 DenisChenu Status assigned => new
2015-11-23 14:33 DenisChenu Severity @50@ => feature
2015-11-23 14:33 DenisChenu Product Version 2.06+ => 2.05+
2015-11-23 14:33 DenisChenu Target Version 2.06+ =>
2015-11-23 15:27 Mazi Issue Monitored: gabrieljenik
2015-11-23 15:34 Mazi Note Added: 33620
2015-11-23 16:08 DenisChenu Note Added: 33621
2015-12-01 14:33 DenisChenu Note Added: 33641
2016-11-06 19:43 DenisChenu Assigned To => DenisChenu
2016-11-06 19:43 DenisChenu Status new => assigned
2016-11-06 19:44 DenisChenu Relationship added child of 11692
2016-11-06 19:44 DenisChenu Tag Attached: answers_html
2016-11-06 19:44 DenisChenu Target Version => 3.0
2016-11-06 19:45 DenisChenu Note Added: 41736
2016-11-06 19:46 DenisChenu Note Added: 41737
2016-11-07 19:29 DenisChenu Relationship deleted child of 11692
2016-11-07 19:29 DenisChenu Relationship added related to 11692
2016-11-08 01:59 DenisChenu Changeset attached => LimeSurvey answers_html b15dba57
2016-11-08 01:59 DenisChenu Note Added: 41766
2016-11-08 01:59 DenisChenu Resolution open => fixed
2016-11-08 01:59 DenisChenu Assigned To DenisChenu =>
2016-11-08 01:59 DenisChenu Status assigned => new
2016-11-08 02:00 DenisChenu Resolution fixed => open
2016-11-08 02:00 DenisChenu Target Version 3.0 =>
2016-11-08 02:01 DenisChenu Note Added: 41767
2016-11-14 15:52 LouisGac Note Added: 41895
2016-11-14 15:53 LouisGac Assigned To => LouisGac
2016-11-14 15:53 LouisGac Status new => assigned
2016-11-14 16:42 DenisChenu Note Added: 41908
2016-11-14 16:42 DenisChenu Note Edited: 41908
2016-11-18 14:50 LouisGac Note Added: 42063
2016-11-18 15:03 DenisChenu Note Added: 42064
2016-11-18 15:08 DenisChenu Note Added: 42065
2016-11-18 15:08 DenisChenu Note Edited: 42065
2016-11-19 01:09 DenisChenu Note Added: 42069
2017-02-28 17:37 jelo Note Added: 43105
2017-02-28 17:42 DenisChenu Note Added: 43106
2017-03-01 14:51 DenisChenu Relationship added related to 12162
2017-03-02 10:37 LouisGac Note Added: 43117
2017-03-02 10:42 DenisChenu Note Added: 43118
2017-03-02 10:43 DenisChenu Note Edited: 43118
2017-03-02 10:43 DenisChenu Note Edited: 43118
2017-03-02 10:47 LouisGac Note Added: 43120
2017-03-02 10:51 DenisChenu Note Added: 43121
2017-03-02 11:01 LouisGac Note Added: 43122
2017-03-02 11:08 LouisGac Note Added: 43123
2017-06-21 11:05 UpsKeineTN Issue Monitored: UpsKeineTN
2018-01-25 22:24 jelo Note Added: 46103
2018-01-26 09:22 UpsKeineTN Issue End Monitor: UpsKeineTN
2018-11-01 16:22 DenisChenu Note Added: 49503