View Issue Details

IDProjectCategoryView StatusLast Update
09828Bug reports[All Projects] Survey takingpublic2019-04-27 07:57
ReporterDenisChenuAssigned ToDenisChenu 
PriorityimmediateSeverityminor 
Status closedResolutionfixed 
Product Version2.06+ 
Target VersionFixed in Version2.50.x 
Summary09828: Ranking question : update allowed can broke Survey DB
Description

In ranking question : Add an answer is allowed : adding answer broke survey

Steps To Reproduce

1: Create a survey with a ranking question with 2 answers.
2: activate survey
3: Add a new answer
4: launch survey

See : Did not save / An unexpected error has occurred and your responses cannot be saved.

Additional Information

Each answer create a DB column, then adding answers must be disallowed. Can be allowed :

  • Update answer code
  • Remove answers

Another solution can be :

  • Use max answers for column creation
  • At activation : set max ansers to actual answer number if is not set.

This fix the X column creation if we need only 2/3 answers.

TagsNo tags attached.
Complete LimeSurvey version number (& build)150812
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database & DB-Versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Versionnot relevant

Relationships

related to 11396 closedDenisChenu Expression manager foir max_answers ranking are not comptletly used 
related to 14819 closedDenisChenu Incorrect behavior with Question of type R (Classement) 

Activities

DenisChenu

DenisChenu

2015-08-12 15:31

developer  

survey_archive_rankingBroken.lsa (3,139 bytes)
DenisChenu

DenisChenu

2015-08-12 15:31

developer  

RANKING_InternalServerError.html (1,362 bytes)
DenisChenu

DenisChenu

2015-08-12 15:31

developer   ~32936

Adding LSA : not sure import system work here.

DenisChenu

DenisChenu

2015-08-12 15:35

developer   ~32937

An error occurred saving a response to survey id Broken ranking - 958678

DATA TO BE ENTERED:
token:
958678X981X148571: A3
958678X981X148572: A2
958678X981X148573: A1

SQL CODE THAT FAILED:

ERROR MESSAGE:

c_schmitz

c_schmitz

2015-12-08 16:55

administrator   ~33757

When I introduced the subquestion I did not realize that these would not have been answer options but subquestions, instead.

DenisChenu

DenisChenu

2015-12-08 17:06

developer   ~33760

Last edited: 2015-12-08 17:07

View 2 revisions

I like the

  • Use max answers for column creation
  • At activation : set max ansers to actual answer number if is not set.
  • disable ├╣ax answers update after activbation

Because sometimes you show 100 answers and need only 5 (for example). Or an new attribute for this question ?

PS: here : update answers must be allowed. It's add more answer than at started survey.

ollehar

ollehar

2016-06-02 15:23

administrator   ~39086

Could you paste the entire SQL query that's faulty, please?

DenisChenu

DenisChenu

2016-06-02 16:16

developer  

Exception.html (33,767 bytes)
DenisChenu

DenisChenu

2016-06-02 16:20

developer   ~39090

Uploaded Exception.html .

But the issue here is : adding an answer add a "column" for ranking question, even after activate.

Like alredy said:

  • Use QuestionAttribute "max_answers" for the number of columns can be a solution. ANd can fix some bug like : select 3 answer in a list of 200 answers (where 200 columns is added).
ollehar

ollehar

2016-06-09 16:18

administrator   ~39372

Is this 2.06 or 2.5 or both?

DenisChenu

DenisChenu

2016-06-09 16:29

developer   ~39373

Both : Exception.html was done with 2.50. But 2.06 have the same issue.

The issue is really : set column number according to ANSWER. We allow updating answer and not SubQUestion.

Like already said :

  • We must allow updating answer (code)
  • Remove answer : no problem
  • Add more answer : issue can happen

I really think have a new core question settings for "number of columns" to create is the best way for user (surely not for dev ;) )

ollehar

ollehar

2016-06-09 16:32

administrator   ~39374

For consistency, I think I'll make it impossible to delete/create answer options while the survey is active (as with regular questions).

DenisChenu

DenisChenu

2016-06-09 16:35

developer   ~39375

@olle : All answer can be updated, SubQuestion can not be updated.

See "single choice" question type for example.

ollehar

ollehar

2016-06-09 17:11

administrator   ~39379

I see some problems with using "Maximum answers" attribute.

  1. If user creates 4 answer options and set "Maximum answers" to 2, would the user be able to update the answer options after survey activation?

  2. Maybe the user sets "Maximum answers" to 999. Then we would have to create 999 columns in the database.

Comments?

DenisChenu

DenisChenu

2016-06-09 17:29

developer   ~39380

2: if user add 9999 answer before activate : Try to create 999 columns : it's amlready the case, and can break some survey where you want ony the 3 first in a 200 list (you must use alternate solution : http://demonstration.sondages.pro/714997)

1: It's the reason why i propose nto ADD a new attribute, when activate : set it by defaulot to actual answers number. User can add any answers : whe only allow 2 to be ranked.

The "maxDBanswers" are deactivated when survey is activated. When survey runtime : $maxDBanswers = min($maxDBanswers,count($answers)) : all other are set to null value.

ollehar

ollehar

2016-06-09 18:00

administrator   ~39385

I agree with adding an attribute instead of hijacking an already existent one. Will ask Carsten tomorrow.

ollehar

ollehar

2016-06-14 14:01

administrator   ~39541

Possible to get it to work with already activated surveys? Should not get worse, at least (attribute __max_db_answers might not exist).

DenisChenu

DenisChenu

2016-06-14 14:04

developer   ~39542

We can add answer only when editing question, but you're right : there are potential issue with old surveys .

ollehar

ollehar

2016-06-14 16:13

administrator   ~39550

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

c_schmitz

c_schmitz

2016-06-17 08:45

administrator   ~39646

Version 2.50+ Build 160616 released

DenisChenu

DenisChenu

2016-06-17 09:25

developer   ~39660

See https://github.com/LimeSurvey/LimeSurvey/pull/507

Foixed by : allow ADMIN to set max columns on DB.

DenisChenu

DenisChenu

2016-06-17 16:47

developer   ~39678

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

DenisChenu

DenisChenu

2016-06-17 16:58

developer   ~39680

I do a fix for my 2.06 : you want it for lts ?

c_schmitz

c_schmitz

2016-06-20 15:31

administrator   ~39731

Version 2.50 Build 160620 released

DenisChenu

DenisChenu

2017-08-23 13:49

developer   ~44337

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

LouisGac

LouisGac

2017-08-28 12:05

manager   ~44366

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

markusfluer

markusfluer

2017-09-01 16:02

administrator   ~44395

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

Related Changesets

LimeSurvey: master 2306449d

2016-06-14 13:22:12

ollehar

Details Diff
Fixed issue 09828: Ranking question : update allowed can broke Survey DB Affected Issues
09828
mod - application/controllers/admin/database.php Diff File
mod - application/helpers/admin/activate_helper.php Diff File

LimeSurvey: master 5653348c

2016-06-15 14:23:28

DenisChenu

Details Diff
Fixed issue 09828: Ranking question : update allowed can broke Survey DB
Dev: add a new QuestionAttribute maxDBanswers, not updatable if survey is activated
Dev: fix max_answers according to this attribute
Dev: Have only maxDBanswers in survey runtime, then other are not set
Dev: Sub question by answer number OR attribute in createFieldMap
Dev: todo : some fix specific to EM
Dev: set maxDBanswers when update and when import LSA
Affected Issues
09828
mod - application/controllers/admin/database.php Diff File
mod - application/helpers/admin/activate_helper.php Diff File
mod - application/helpers/common_helper.php Diff File
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/helpers/qanda_helper.php Diff File

LimeSurvey: master 9cbb9ba0

2017-08-23 13:49:19

DenisChenu

Details Diff
Dev: Re-fix issue 09828 : adding subquestion multiple times update max_subquestions
Dev: Adding attribute only if not exist
Dev: related https://github.com/LimeSurvey/LimeSurvey/commit/d09e6d4423cdfd1d216231dd9ac1396fcd621f68#diff-4c8b6e0396ccd2f7fad4f57489b63b06L156 and https://github.com/LimeSurvey/LimeSurvey/pull/507
Affected Issues
09828
mod - application/controllers/admin/database.php Diff File

LimeSurvey: develop 40df2b90

2017-08-23 13:49:19

DenisChenu


Committer: LouisGac Details Diff
Dev: Re-fix issue 09828 : adding subquestion multiple times update max_subquestions
Dev: Adding attribute only if not exist
Dev: related https://github.com/LimeSurvey/LimeSurvey/commit/d09e6d4423cdfd1d216231dd9ac1396fcd621f68#diff-4c8b6e0396ccd2f7fad4f57489b63b06L156 and https://github.com/LimeSurvey/LimeSurvey/pull/507
Affected Issues
09828
mod - application/controllers/admin/database.php Diff File

LimeSurvey: develop a60d96bc

2017-08-23 13:49:19

DenisChenu


Committer: markusfluer Details Diff
Revert "Dev: Re-fix issue 09828 : adding subquestion multiple times update max_subquestions"

This reverts commit 40df2b90619fa3fda5d4fa2effb786097737ee67.
Affected Issues
09828
mod - application/controllers/admin/database.php Diff File

Issue History

Date Modified Username Field Change
2015-08-12 15:28 DenisChenu New Issue
2015-08-12 15:31 DenisChenu File Added: survey_archive_rankingBroken.lsa
2015-08-12 15:31 DenisChenu File Added: RANKING_InternalServerError.html
2015-08-12 15:31 DenisChenu Note Added: 32936
2015-08-12 15:35 DenisChenu Note Added: 32937
2015-08-14 10:49 c_schmitz Assigned To => c_schmitz
2015-08-14 10:49 c_schmitz Status new => assigned
2015-12-08 16:55 c_schmitz Note Added: 33757
2015-12-08 17:06 DenisChenu Note Added: 33760
2015-12-08 17:07 DenisChenu Note Edited: 33760 View Revisions
2016-02-29 15:34 c_schmitz Status assigned => acknowledged
2016-03-15 11:17 LouisGac Product Version => 2.06+
2016-05-27 09:39 c_schmitz Assigned To c_schmitz =>
2016-05-27 09:39 c_schmitz Status acknowledged => new
2016-05-27 09:39 c_schmitz Priority normal => immediate
2016-06-02 15:23 ollehar Note Added: 39086
2016-06-02 16:16 DenisChenu File Added: Exception.html
2016-06-02 16:20 DenisChenu Note Added: 39090
2016-06-09 16:17 ollehar Assigned To => ollehar
2016-06-09 16:17 ollehar Status new => assigned
2016-06-09 16:18 ollehar Note Added: 39372
2016-06-09 16:29 DenisChenu Note Added: 39373
2016-06-09 16:32 ollehar Note Added: 39374
2016-06-09 16:35 DenisChenu Note Added: 39375
2016-06-09 17:11 ollehar Note Added: 39379
2016-06-09 17:29 DenisChenu Note Added: 39380
2016-06-09 18:00 ollehar Note Added: 39385
2016-06-14 09:57 ollehar Assigned To ollehar =>
2016-06-14 09:57 ollehar Assigned To => ollehar
2016-06-14 09:57 ollehar Status assigned => new
2016-06-14 09:57 ollehar Assigned To ollehar =>
2016-06-14 13:11 ollehar Assigned To => ollehar
2016-06-14 13:11 ollehar Status new => assigned
2016-06-14 13:11 ollehar Sticky Issue No => Yes
2016-06-14 14:01 ollehar Note Added: 39541
2016-06-14 14:04 DenisChenu Note Added: 39542
2016-06-14 16:13 ollehar Changeset attached => LimeSurvey master 2306449d
2016-06-14 16:13 ollehar Note Added: 39550
2016-06-14 16:13 ollehar Resolution open => fixed
2016-06-14 16:20 ollehar Status assigned => resolved
2016-06-14 16:20 ollehar Fixed in Version => 2.5
2016-06-15 11:01 LouisGac Sticky Issue Yes => No
2016-06-17 08:45 c_schmitz Note Added: 39646
2016-06-17 08:45 c_schmitz Status resolved => closed
2016-06-17 09:24 DenisChenu Relationship added related to 11396
2016-06-17 09:25 DenisChenu Note Added: 39660
2016-06-17 09:25 DenisChenu Status closed => feedback
2016-06-17 09:25 DenisChenu Resolution fixed => reopened
2016-06-17 16:46 DenisChenu Assigned To ollehar => DenisChenu
2016-06-17 16:46 DenisChenu Status feedback => assigned
2016-06-17 16:47 DenisChenu Changeset attached => LimeSurvey master 5653348c
2016-06-17 16:47 DenisChenu Note Added: 39678
2016-06-17 16:58 DenisChenu Status assigned => resolved
2016-06-17 16:58 DenisChenu Resolution reopened => fixed
2016-06-17 16:58 DenisChenu Note Added: 39680
2016-06-20 15:31 c_schmitz Note Added: 39731
2016-06-20 15:31 c_schmitz Status resolved => closed
2017-08-23 13:49 DenisChenu Changeset attached => LimeSurvey master 9cbb9ba0
2017-08-23 13:49 DenisChenu Note Added: 44337
2017-08-28 12:05 LouisGac Changeset attached => LimeSurvey develop 40df2b90
2017-08-28 12:05 LouisGac Note Added: 44366
2017-09-01 16:02 markusfluer Changeset attached => LimeSurvey develop a60d96bc
2017-09-01 16:02 markusfluer Note Added: 44395
2019-04-27 07:57 DenisChenu Relationship added related to 14819