View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|17346||Bug reports||Question editor||public||2021-05-31 14:58||2021-06-07 17:49|
|Summary||17346: Personal setting default question type is ignored when creating questions|
|Description||When selecting a default question type, ex shortfreetext, the array question type is shown as the selected question type.|
Nevertheless the internal settings in memory do consider shortfreetext as the selected type.
This only happens with the simple selector.
|Steps To Reproduce||- Set default to short free text|
- Create question.
- The default selected type is not short free text
|Additional Information||`QuestionTheme::findAllQuestionMetaDataForSelector` is setting name attribute as core for core types. That's usefull for the Personal Settings screen, although not good for the question editor.|
We believe the "setting as core" should be not on the model.
|Tags||No tags attached.|
|Complete LimeSurvey version number (& build)||5.0|
|I will donate to the project if issue is resolved||No|
|Database & DB-Version||Mysql|
|Server OS (if known)|
|Webserver software & version (if known)|
|Are you sure it's saved ? Last time i check : nothing seems saved on user settings.|
|Yes, that's what we are seeing|
|Yes, see the other mantis after (i think i already reported it :( )|
Somehow there is a missmatch in between the core question theme and the names of the core question themes.
Ex: Short free text question theme is core and its name is shortfreetext. Usually core is used on the code, but on the data and the model the name is shortfreetext.
Question themes have a name, like 'arrays/array' or 'bootstrap_buttons'.
There are base (core) question themes and extended question themes (custom or included with Lime).
Some parts of Lime only handle the question themes by name, and treat the core themes as "core" (instead of by their name).
For example, when handling question attributes, it's usually done by question type and question theme name, and 'core' is used as theme name for the basic ones.
That also applies to the question type/theme selector.
The specific problem with this ticket is that question type/theme metadata for the selected question (to mark the selected question type/theme in the selector) is retrieved with QuestionTheme::findQuestionMetaData(), which returns the "real" question theme data, including the saved name.
Since the selector has a list of question type + theme pairs where the theme is 'core' for the basic ones, but the question metadata has the actual theme name ('arrays/array', 'longfreetext', etc), no question type/theme is marked as selected (defaulting to the first one.
It's temporarily solved in T656 by replacing the theme name after retrieving the metadata.
Alternative better approaches follow:
Alternative A) Make the replacement inside findQuestionMetadata(). Other parts of Lime using that function don't rely on the theme name, so it wouldn't have an impact. But, the function is public, so it may be used by third party code.
Alternative B) Make a clone of findQuestionMetadata() adapted for returning "core" sometimes.
Alternative C) Review the usage for findAllQuestionMetaDataForSelector() and make it match to findQuestionMetadata().
> Alternative A) … … so it may be used by third party code.
Young code, out of any API : don't really care, no ?
If you think of « it may be used by third party code» : you don't create i10n function like this.
|2021-05-31 14:58||gabrieljenik||New Issue|
|2021-05-31 15:01||DenisChenu||Relationship added||related to 17310|
|2021-05-31 15:03||DenisChenu||Note Added: 64672|
|2021-05-31 15:08||gabrieljenik||Additional Information Updated||View Revisions|
|2021-05-31 15:09||gabrieljenik||Note Added: 64674|
|2021-05-31 15:13||DenisChenu||Note Added: 64675|
|2021-05-31 15:17||gabrieljenik||Note Added: 64676|
|2021-06-01 10:04||ollehar||Product Version||=> 5.x|
|2021-06-01 19:53||ollehar||Priority||none => normal|
|2021-06-03 16:22||gabrieljenik||Assigned To||=> gabrieljenik|
|2021-06-03 16:22||gabrieljenik||Status||new => assigned|
|2021-06-07 17:42||gabrieljenik||Note Added: 64770|
|2021-06-07 17:49||DenisChenu||Note Added: 64771|