Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20190510.sql =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20190510.sql (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20190510.sql (revision c05bc28426be01ab26818fef24699cea98d568c8) @@ -0,0 +1,17 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4817 Delete existing blank burning questions +DELETE FROM tl_lascrt11_burning_question WHERE question IS NULL OR TRIM(question) = ''; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; + + + Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningController.java =================================================================== diff -u -r3ee06bc1b00b1673399c1871a73cfa1d8ec2c0db -rc05bc28426be01ab26818fef24699cea98d568c8 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningController.java (.../LearningController.java) (revision 3ee06bc1b00b1673399c1871a73cfa1d8ec2c0db) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningController.java (.../LearningController.java) (revision c05bc28426be01ab26818fef24699cea98d568c8) @@ -168,7 +168,7 @@ if (isUserLeader) { Set answerUids = new HashSet<>(); for (ScratchieItem item : scratchie.getScratchieItems()) { - for (ScratchieAnswer answer : (Set) item.getAnswers()) { + for (ScratchieAnswer answer : item.getAnswers()) { answerUids.add(answer.getUid()); } } @@ -627,16 +627,20 @@ final String burningQuestion = request .getParameter(ScratchieConstants.ATTR_BURNING_QUESTION_PREFIX + itemUid); - // update question in sessionMap - item.setBurningQuestion(burningQuestion); + if (StringUtils.isNotBlank(burningQuestion)) { + // update question in sessionMap + item.setBurningQuestion(burningQuestion); - // update new entry - scratchieService.saveBurningQuestion(sessionId, itemUid, burningQuestion); + // update new entry + scratchieService.saveBurningQuestion(sessionId, itemUid, burningQuestion); + } } // handle general burning question final String generalQuestion = request.getParameter(ScratchieConstants.ATTR_GENERAL_BURNING_QUESTION); - scratchieService.saveBurningQuestion(sessionId, null, generalQuestion); + if (StringUtils.isNotBlank(generalQuestion)) { + scratchieService.saveBurningQuestion(sessionId, null, generalQuestion); + } // update general question in sessionMap sessionMap.put(ScratchieConstants.ATTR_GENERAL_BURNING_QUESTION, generalQuestion); }