Relationship Graph

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

View Issue Details

IDProjectCategoryView StatusLast Update
16563Bug reportsSurvey editingpublic2020-08-13 10:53
Reporterestupendu Assigned To 
PriorityhighSeverityblock 
Status resolvedResolutionopen 
Product Version4.3.8 
Summary16563: We cannot create a new question and Limesurvey deletes some answers
Description

When we try to create a new question this error appears in Postgres Log:

  • SELECT * FROM "lime_questions" "t" WHERE sid = 616628 AND qid = '' LIMIT 1
    invalid input syntax for integer: "" at character 65

We attach an error that it appears in the console.

Afterthat we have created the new question directly into the database and It worked but... when we changed some attribute (e.g. hide tip) Limesurvey deletes some answers from database. See attached the database changes:

  • After to create the question:
  • Table lime_answers: lime_answers1.jpg
  • Table lime_answers_I10ns1: lime_answers_I10ns1.jpg
  • Table lime_question_attributes: lime_question_attributes1.jpg
  • After to modify an attribute:
  • Table lime_question_attributes: lime_question_attributes2.jpg
  • Table lime_answers: lime_answers2.jpg (two of three answers options have disapeared)
TagsNo tags attached.
Complete LimeSurvey version number (& build)Version 4.3.8+200803
I will donate to the project if issue is resolvedNo
BrowserChrome
Database & DB-VersionPostgreSQL 9.5
Server OS (if known)Linux Centos
Webserver software & version (if known)
PHP Version7.3.13

Relationships

related to 16566 closedgabrieljenik We cannot create multiple choice questions 

Activities

estupendu

estupendu

2020-08-03 19:09

reporter  

Limesurvey_error.JPG (24,239 bytes)   
Limesurvey_error.JPG (24,239 bytes)   
lime_question_attributes1.jpg (7,682 bytes)   
lime_question_attributes1.jpg (7,682 bytes)   
lime_question_attributes2.jpg (8,928 bytes)   
lime_question_attributes2.jpg (8,928 bytes)   
lime_answers2.jpg (7,553 bytes)   
lime_answers2.jpg (7,553 bytes)   
lime_answers1.jpg (11,732 bytes)   
lime_answers1.jpg (11,732 bytes)   
lime_answers_I10ns1.jpg (23,728 bytes)   
lime_answers_I10ns1.jpg (23,728 bytes)   
gabrieljenik

gabrieljenik

2020-08-10 18:36

developer   ~59397

Random characters sometimes could come on qid when creating new questions as those are used by vue to identify internally new rows.

Before issue 16469, QuestionEditorController tried to find the questions using 'findByPk', which automatically casts the value to int, removing characters.

Now, 'find' is used because the survey ID is added to the search criterias.
qid is not casted and no objects are found.

When saving a new question, Question object is empty, and the resulting SQL fails in Postgres because of the data type.
Solved by casting 'qid' to int.

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1543
Contains both fix for 16566 and 16563

user225042

2020-08-12 14:11

  ~59445

Last edited: 2020-08-13 10:53

Try adding answer options and sub question and modifying from the front end, seems to work as expected AND WAS SUCCESSFULLY ABLE TO ADD QUESTION

Related Changesets

LimeSurvey: master 16425fff

2020-08-12 17:50:51

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16566: We cannot create multiple choice questions (#1543)

Dev: Before issue 16469, QuestionEditorController tried to find the questions using 'findByPk', which automatically casts the value to int. Now, 'find' is used because the survey ID, as the search is done by multiple criterias.
Dev: When saving a new question, 'qid' is an empty string, and the resulting SQL fails in Postgres because of the data type. Solved by casting 'qid' to int.
Dev: This also helps with issue 16563.
Dev: Casting subquestion id as to remove the random characters vue id adds for its view.
Affected Issues
16469, 16563, 16566
mod - application/controllers/QuestionEditorController.php Diff File

Issue History

Date Modified Username Field Change
2020-08-03 19:09 estupendu New Issue
2020-08-03 19:09 estupendu File Added: Limesurvey_error.JPG
2020-08-03 19:09 estupendu File Added: lime_question_attributes1.jpg
2020-08-03 19:09 estupendu File Added: lime_question_attributes2.jpg
2020-08-03 19:09 estupendu File Added: lime_answers2.jpg
2020-08-03 19:09 estupendu File Added: lime_answers1.jpg
2020-08-03 19:09 estupendu File Added: lime_answers_I10ns1.jpg
2020-08-04 18:06 cdorin Priority none => high
2020-08-04 18:06 cdorin Status new => confirmed
2020-08-04 18:06 cdorin Description Updated View Revisions
2020-08-10 18:27 gabrieljenik Relationship added related to 16566
2020-08-10 18:36 gabrieljenik Note Added: 59397
2020-08-12 14:11 user225042 Note Added: 59445
2020-08-12 17:50 gabrieljenik Changeset attached => LimeSurvey master 16425fff
2020-08-13 10:53 swendrich Status confirmed => resolved
2020-08-13 10:53 swendrich Status confirmed => resolved