Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190110.sql =================================================================== diff -u -r3d4f3d2cad3815a4df319c1e278aab4a90409456 -r13138a412c6f053edaf9e70ee5efdc534d921565 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190110.sql (.../patch20190110.sql) (revision 3d4f3d2cad3815a4df319c1e278aab4a90409456) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190110.sql (.../patch20190110.sql) (revision 13138a412c6f053edaf9e70ee5efdc534d921565) @@ -95,7 +95,7 @@ CREATE TABLE tmp_question (question_uid BIGINT PRIMARY KEY, content MEDIUMTEXT) AS SELECT q.uid AS question_uid, - GROUP_CONCAT(TRIM(question), TRIM(mc_que_option_text) ORDER BY displayOrder) AS content + GROUP_CONCAT(TRIM(REPLACE(REPLACE(question, '\r', ''), '\n', '')), TRIM(REPLACE(REPLACE(mc_que_option_text, '\r', ''), '\n', '')) ORDER BY displayOrder) AS content FROM tl_lamc11_que_content AS q JOIN tl_lamc11_options_content AS o ON q.uid = o.mc_que_content_id GROUP BY q.uid; @@ -120,7 +120,7 @@ SELECT NULL, 0, 1, @question_id:=@question_id + 1, 1, IFNULL(c.creation_date, NOW()), 'MCQ question', mcq.question, IFNULL(mcq.max_mark, 1), mcq.feedback, q.target_uid FROM (SELECT uid, - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM question))) AS question, + TRIM(REPLACE(REPLACE(question, '\r', ''), '\n', '')) AS question, mark AS max_mark, IF(TRIM(feedback) = '', NULL, TRIM(feedback)) AS feedback, mc_content_id @@ -149,7 +149,7 @@ -- fill table with options matching unique QB questions inserted above INSERT INTO lams_qb_option (qb_question_uid, display_order, name, correct) - SELECT q.uid, o.displayOrder, TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.mc_que_option_text))), o.correct_option + SELECT q.uid, o.displayOrder, TRIM(REPLACE(REPLACE(o.mc_que_option_text, '\r', ''), '\n', '')), o.correct_option FROM tl_lamc11_options_content AS o JOIN lams_qb_question AS q ON o.mc_que_content_id = q.tmp_question_id @@ -194,8 +194,8 @@ -- if this column is not *exactly* as in an other row, it means it should be a separate question in QB INSERT INTO tmp_question SELECT q.uid, - GROUP_CONCAT(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM q.description))), - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.description))) ORDER BY o.order_id) + GROUP_CONCAT(TRIM(REPLACE(REPLACE(q.description, '\r', ''), '\n', '')), + TRIM(REPLACE(REPLACE(o.description, '\r', ''), '\n', '')) ORDER BY o.order_id) FROM tl_lascrt11_scratchie_item AS q JOIN tl_lascrt11_scratchie_answer AS o ON q.uid = o.scratchie_item_uid @@ -231,8 +231,8 @@ SELECT NULL, 0, 1, @question_id:=@question_id + 1, 1, sq.create_date, sq.question, sq.description, NULL, NULL, q.target_uid FROM (SELECT uid, - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM title))) AS question, - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM description))) AS description, + TRIM(REPLACE(REPLACE(title, '\r', ''), '\n', '')) AS question, + TRIM(REPLACE(REPLACE(description, '\r', ''), '\n', '')) AS description, create_date FROM tl_lascrt11_scratchie_item) AS sq JOIN (SELECT DISTINCT target_uid FROM tmp_question_match) AS q @@ -286,7 +286,7 @@ -- fill table with options matching unique QB questions inserted above INSERT INTO lams_qb_option (qb_question_uid, display_order, name, correct) - SELECT q.uid, o.order_id, TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.description))), o.correct + SELECT q.uid, o.order_id, TRIM(REPLACE(REPLACE(o.description, '\r', ''), '\n', '')), o.correct FROM tl_lascrt11_scratchie_answer AS o JOIN lams_qb_question AS q ON o.scratchie_item_uid = q.tmp_question_id @@ -341,8 +341,8 @@ -- if this column is not *exactly* as in an other row, it means it should be a separate question in QB INSERT INTO tmp_question SELECT q.uid, - GROUP_CONCAT(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM q.question))), - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.option_string))) ORDER BY o.sequence_id) + GROUP_CONCAT(TRIM(REPLACE(REPLACE(q.question, '\r', ''), '\n', '')), + TRIM(REPLACE(REPLACE(o.option_string, '\r', ''), '\n', '')) ORDER BY o.sequence_id) FROM tl_laasse10_assessment_question AS q JOIN tl_laasse10_question_option AS o ON q.uid = o.question_uid @@ -386,9 +386,9 @@ INSERT INTO tmp_question SELECT q.uid, - GROUP_CONCAT(q.question_type, IFNULL(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM q.question))), ''), q.correct_answer, - IFNULL(CONCAT(IFNULL(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.question))), ''), - IFNULL(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.option_string))), ''), o.option_float, o.correct), '') + GROUP_CONCAT(q.question_type, IFNULL(TRIM(REPLACE(REPLACE(q.question, '\r', ''), '\n', '')), ''), q.correct_answer, + IFNULL(CONCAT(IFNULL(TRIM(REPLACE(REPLACE(o.question, '\r', ''), '\n', '')), ''), + IFNULL(TRIM(REPLACE(REPLACE(o.option_string, '\r', ''), '\n', '')), ''), o.option_float, o.correct), '') ORDER BY o.sequence_id) FROM tl_laasse10_assessment_question AS q LEFT JOIN tl_laasse10_question_option AS o @@ -413,8 +413,8 @@ aq.feedback_on_incorrect, aq.shuffle, aq.prefix_answers_with_letters, aq.case_sensitive, aq.correct_answer, aq.allow_rich_editor, aq.max_words_limit, aq.min_words_limit, aq.hedging_justification_enabled, q.target_uid FROM (SELECT uid, - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM title))) AS question, - TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM question))) AS description, + TRIM(REPLACE(REPLACE(title, '\r', ''), '\n', '')) AS question, + TRIM(REPLACE(REPLACE(question, '\r', ''), '\n', '')) AS description, default_grade AS max_mark, question_type, IF(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM general_feedback)))= '', @@ -481,7 +481,7 @@ -- fill table with options matching unique QB questions inserted above INSERT INTO lams_qb_option (qb_question_uid, display_order, name, correct, matching_pair, numerical_option, max_mark, accepted_error, feedback) - SELECT q.uid, o.sequence_id, IFNULL(TRIM(TRIM(BOTH '\r' FROM TRIM(BOTH '\n' FROM o.option_string))), ''), o.correct, o.question, o.option_float, + SELECT q.uid, o.sequence_id, IFNULL(TRIM(REPLACE(REPLACE(o.option_string, '\r', ''), '\n', '')), ''), o.correct, o.question, o.option_float, o.grade, o.accepted_error, o.feedback FROM tl_laasse10_question_option AS o JOIN lams_qb_question AS q