Skip to content

Commit

Permalink
Fixed issue #CT-681: Answer options order (answer_order) is missing a…
Browse files Browse the repository at this point in the history
…s an attribute definition and causes the value to not persist through tsv exports and imports (#3777)
  • Loading branch information
ptelu committed Mar 11, 2024
1 parent 71066ca commit 9bf614c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion application/helpers/questionHelper.php
Expand Up @@ -836,7 +836,7 @@ public static function getAttributesDefinitions()
);

self::$attributes["random_order"] = array(
"types" => Question::QT_EXCLAMATION_LIST_DROPDOWN . Question::QT_A_ARRAY_5_POINT . Question::QT_B_ARRAY_10_CHOICE_QUESTIONS . Question::QT_C_ARRAY_YES_UNCERTAIN_NO . Question::QT_E_ARRAY_INC_SAME_DEC . Question::QT_F_ARRAY . Question::QT_H_ARRAY_COLUMN . Question::QT_K_MULTIPLE_NUMERICAL . Question::QT_L_LIST . Question::QT_M_MULTIPLE_CHOICE . Question::QT_O_LIST_WITH_COMMENT . Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS . Question::QT_Q_MULTIPLE_SHORT_TEXT . Question::QT_R_RANKING . Question::QT_1_ARRAY_DUAL . Question::QT_COLON_ARRAY_NUMBERS . Question::QT_SEMICOLON_ARRAY_TEXT,
"types" => Question::QT_A_ARRAY_5_POINT . Question::QT_B_ARRAY_10_CHOICE_QUESTIONS . Question::QT_C_ARRAY_YES_UNCERTAIN_NO . Question::QT_E_ARRAY_INC_SAME_DEC . Question::QT_F_ARRAY . Question::QT_H_ARRAY_COLUMN . Question::QT_K_MULTIPLE_NUMERICAL . Question::QT_M_MULTIPLE_CHOICE . Question::QT_O_LIST_WITH_COMMENT . Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS . Question::QT_Q_MULTIPLE_SHORT_TEXT . Question::QT_1_ARRAY_DUAL . Question::QT_COLON_ARRAY_NUMBERS . Question::QT_SEMICOLON_ARRAY_TEXT,
'category' => gT('Display'),
'sortorder' => 100,
'inputtype' => 'singleselect',
Expand All @@ -848,6 +848,19 @@ public static function getAttributesDefinitions()
"caption" => gT('Random order')
);

self::$attributes["answer_order"] = array(
"types" => Question::QT_L_LIST . Question::QT_R_RANKING . Question::QT_EXCLAMATION_LIST_DROPDOWN,
'category' => gT('Display'),
'sortorder' => 100,
'inputtype' => 'singleselect',
'options' => array('normal' => gT('Normal'), 'random' => gT("Random"), 'alphabetical' => gT("Alphabetical")),
//1=>gT('Randomize on each page load') // Shnoulle : replace by yes till we have only one solution
//2=>gT('Randomize once on survey start') //Mdekker: commented out as code to handle this was removed in refactoring
'default' => 0,
"help" => gT('Present answer options in normal, random or alphabetical order'),
"caption" => gT('Answer options order')
);

self::$attributes["showpopups"] = array(
"types" => Question::QT_R_RANKING,
'category' => gT('Display'),
Expand Down
3 changes: 3 additions & 0 deletions application/models/QuestionTemplate.php
Expand Up @@ -381,9 +381,12 @@ public function getCustomAttributes()
* @param string $type
* @return array
* @todo Move to QuestionTheme?
* @todo This is not the same as QuestionTheme::findQuestionMetaDataForAllTypes() which is the database layer
* @todo this should check the filestructure instead of the database as this is the filestructure layer
*/
public static function getQuestionTemplateList($type)
{
// todo: incorrect, this should check the filestructure instead of the database as this is the filestructure layer
/** @var QuestionTheme[] */
$questionThemes = QuestionTheme::model()->findAllByAttributes(
[],
Expand Down

0 comments on commit 9bf614c

Please sign in to comment.