View Issue Details

This bug affects 1 person(s).
 24
IDProjectCategoryView StatusLast Update
13677Bug reportsSurvey editingpublic2020-03-06 19:00
Reporterwehr Assigned To 
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version3.7.x 
Fixed in Version3.13.x 
Summary13677: Sorting of groups and questions are wrong (with fix)
Description

Hi,

Currently the ordering of question groups and questions in the survey list (question explorer) and the final survey itself is wrong.

regards,
Mario

Steps To Reproduce

Create 3x Groups and in every Group 3x questions.
You will get:
Group 2 (order index 1)
Q2 (order index 1)
Q3 (order index 2)
Q1 (order index 0)
Group 3 (order index 2)
Q2 (order index 1)
Q3 (order index 2)
Q1 (order index 0)
Group 1 (order index 0)
Q2 (order index 1)
Q3 (order index 2)
Q1 (order index 0)

You can see that the first group with order index 0 is sorted as last and every question with order index 0 in the corresponding group is also sorted as last item.

Additional Information

How to fix it:
In _questionsgroups.vue / lsadminpanel.js
#31 and #88
the problem is the orderBy() call.
return parseInt(a.group_order || 999999)
and
return parseInt(a.question_order || 999999);
in case of "order" == 0 the "||" uses 99999 because 0 can be converted to false.
A fix would be to throw-away the "|| 999999" part" ?

TagsNo tags attached.
Attached Files
Selection_999(020).png (24,878 bytes)   
Selection_999(020).png (24,878 bytes)   
Bug heat24
Complete LimeSurvey version number (& build)3.7.2 github master
I will donate to the project if issue is resolvedNo
BrowserFirefox 60, Chrome 66
Database type & versionPostgreSQL 10.4
Server OS (if known)Linux Debian Stretch
Webserver software & version (if known)Apache/2.4.25 (Debian)
PHP Version 7.2.5

Relationships

has duplicate 13851 closedmarkusfluer Disorder of Survey structure 
has duplicate 13729 closedmarkusfluer Question group order incorrect 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2018-05-18 10:07

developer   ~47675

Thanks for reporting it and find the issue.
Maybe you can put a pull request ?

wehr

wehr

2018-05-18 20:01

reporter   ~47690

Sure no problem.
Should I push the proposed fix with stripping the "|| 999999" part?

DenisChenu

DenisChenu

2018-05-19 11:02

developer   ~47694

Yes, i didn't see issue to strip this part :) (but i can make error like all dev). Thank you :)

markusfluer

markusfluer

2018-07-12 11:54

administrator   ~48497

Completely ignoring the fallback is not the right solution imho, but you are right it should be strictly checking for non integer values.
If you like you can do a pull request, but we can also fix it.

markusfluer

markusfluer

2018-08-07 17:01

administrator   ~48682

Release 3.14.2+180807

c_schmitz

c_schmitz

2020-02-13 11:11

administrator   ~55938

Can't see any commit with a fix anywhere. Reopening.

c_schmitz

c_schmitz

2020-02-13 11:11

administrator   ~55939

Pull request at https://github.com/LimeSurvey/LimeSurvey/pull/1348

c_schmitz

c_schmitz

2020-02-13 11:17

administrator   ~55940

Also see https://stackoverflow.com/a/14579013

ollehar

ollehar

2020-02-18 13:55

administrator   ~56072

Please always attach a survey with which we can reproduce the issue.

ollehar

ollehar

2020-02-18 14:08

administrator   ~56073

Cannot reproduce. What I did was adding 3 groups and then 3 questions in each group. End result is attached (question codes are not wrong, I added the first question to the last group by mistake).

ollehar

ollehar

2020-02-19 12:10

administrator   ~56091

Fix pushed to 3.x-LTS branch.

lime_release_bot

lime_release_bot

2020-02-19 12:33

administrator   ~56094

Fixed in Release 3.22.6+200219

ollehar

ollehar

2020-02-25 16:00

administrator   ~56200

Anyone knows if this is a problem in LS4 as well?

ollehar

ollehar

2020-03-06 16:33

administrator   ~56355

Last edited: 2020-03-06 16:34

Looks like in LS4, it starts counting from 1 and not 0 even on Postgres:

937         $oQuestionGroup->group_order = safecount($oSurvey->groups)+1;                                                                                                                                                                  

Will close this.

DenisChenu

DenisChenu

2020-03-06 19:00

developer   ~56356

Looks like in LS4, it starts counting from 1 and not 0 even on Postgres:

Is test was done to be sure it don't break something other .... maybe in some month ....

Issue History

Date Modified Username Field Change
2018-05-16 13:04 wehr New Issue
2018-05-18 10:07 DenisChenu Note Added: 47675
2018-05-18 20:01 wehr Note Added: 47690
2018-05-19 11:02 DenisChenu Note Added: 47694
2018-05-23 10:38 LouisGac Assigned To => dominikvitt
2018-05-23 10:38 LouisGac Status new => assigned
2018-05-31 14:29 dominikvitt Assigned To dominikvitt => markusfluer
2018-07-12 11:54 markusfluer Note Added: 48497
2018-07-12 11:54 markusfluer Relationship added has duplicate 13851
2018-07-12 12:01 markusfluer Relationship added has duplicate 13729
2018-08-06 17:13 markusfluer Status assigned => resolved
2018-08-06 17:13 markusfluer Resolution open => fixed
2018-08-06 17:13 markusfluer Fixed in Version => 3.13.x
2018-08-07 17:01 markusfluer Status resolved => closed
2018-08-07 17:01 markusfluer Note Added: 48682
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing
2020-02-13 11:11 c_schmitz Assigned To markusfluer =>
2020-02-13 11:11 c_schmitz Status closed => feedback
2020-02-13 11:11 c_schmitz Resolution fixed => reopened
2020-02-13 11:11 c_schmitz Note Added: 55938
2020-02-13 11:11 c_schmitz Note Added: 55939
2020-02-13 11:17 c_schmitz Note Added: 55940
2020-02-18 13:55 ollehar Note Added: 56072
2020-02-18 14:08 ollehar File Added: Selection_999(020).png
2020-02-18 14:08 ollehar Note Added: 56073
2020-02-19 12:10 ollehar Note Added: 56091
2020-02-19 12:33 lime_release_bot Note Added: 56094
2020-02-19 12:33 lime_release_bot Status feedback => closed
2020-02-19 12:33 lime_release_bot Resolution reopened => fixed
2020-02-25 16:00 ollehar Note Added: 56200
2020-03-06 16:33 ollehar Note Added: 56355
2020-03-06 16:33 ollehar Note Edited: 56355
2020-03-06 16:34 ollehar Note Edited: 56355
2020-03-06 19:00 DenisChenu Note Added: 56356