Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== diff -u -rffd223618c1aa29b58749a9ccfa54e26095a47dd -r517fff7d1277da3dc87cdb913e8691c8323bb8fd --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision ffd223618c1aa29b58749a9ccfa54e26095a47dd) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision 517fff7d1277da3dc87cdb913e8691c8323bb8fd) @@ -844,10 +844,10 @@ } else if (questionDto.getType() == QbQuestion.TYPE_ORDERING) { float maxMarkForCorrectAnswer = maxMark / questionDto.getOptionDtos().size(); - + Set originalOptions = (new QuestionDTO(questionResult.getQbToolQuestion())).getOptionDtos(); ArrayList optionsInCorrectOrder = new ArrayList<>(originalOptions); - + int i = 0; for (OptionDTO optionDto : questionDto.getOptionDtos()) { if (optionDto.getUid().equals(optionsInCorrectOrder.get(i++).getUid())) { @@ -3417,7 +3417,7 @@ String uuid = JsonUtil.optString(questionJSONData, RestTags.QUESTION_UUID); // try to match the question to an existing QB question in DB - if (uuid != null) { + if (StringUtils.isNotBlank(uuid)) { qbQuestion = qbService.getQuestionByUUID(UUID.fromString(uuid)); } @@ -3427,8 +3427,8 @@ qbQuestion = new QbQuestion(); qbQuestion.setQuestionId(qbService.generateNextQuestionId()); qbQuestion.setType(type); - qbQuestion.setName(questionJSONData.get(RestTags.QUESTION_TITLE).asText()); - qbQuestion.setDescription(questionJSONData.get(RestTags.QUESTION_TEXT).asText()); + qbQuestion.setName(JsonUtil.optString(questionJSONData, RestTags.QUESTION_TITLE)); + qbQuestion.setDescription(JsonUtil.optString(questionJSONData, RestTags.QUESTION_TEXT)); qbQuestion.setAllowRichEditor( JsonUtil.optBoolean(questionJSONData, RestTags.ALLOW_RICH_TEXT_EDITOR, Boolean.FALSE)); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java =================================================================== diff -u -rffd223618c1aa29b58749a9ccfa54e26095a47dd -r517fff7d1277da3dc87cdb913e8691c8323bb8fd --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java (.../McService.java) (revision ffd223618c1aa29b58749a9ccfa54e26095a47dd) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java (.../McService.java) (revision 517fff7d1277da3dc87cdb913e8691c8323bb8fd) @@ -2053,7 +2053,7 @@ String uuid = JsonUtil.optString(questionData, RestTags.QUESTION_UUID); // try to match the question to an existing QB question in DB - if (uuid != null) { + if (StringUtils.isNotBlank(uuid)) { qbQuestion = qbService.getQuestionByUUID(UUID.fromString(uuid)); } @@ -2063,7 +2063,8 @@ qbQuestion = new QbQuestion(); qbQuestion.setQuestionId(qbService.generateNextQuestionId()); qbQuestion.setType(QbQuestion.TYPE_MULTIPLE_CHOICE); - qbQuestion.setName(JsonUtil.optString(questionData, RestTags.QUESTION_TEXT)); + qbQuestion.setName(JsonUtil.optString(questionData, RestTags.QUESTION_TITLE)); + qbQuestion.setDescription(JsonUtil.optString(questionData, RestTags.QUESTION_TEXT)); qbQuestion.setMaxMark(1); userManagementService.save(qbQuestion); @@ -2083,7 +2084,7 @@ question = new McQueContent(qbQuestion, JsonUtil.optInt(questionData, RestTags.DISPLAY_ORDER), mcq); saveOrUpdateMcQueContent(question); - // all questions need to end up in user's private collection + // all questions need to end up in user's private collection if (addToCollection) { qbService.addQuestionToCollection(collection.getUid(), qbQuestion.getQuestionId(), false); collectionUUIDs.add(uuid); Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -rffd223618c1aa29b58749a9ccfa54e26095a47dd -r517fff7d1277da3dc87cdb913e8691c8323bb8fd --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision ffd223618c1aa29b58749a9ccfa54e26095a47dd) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 517fff7d1277da3dc87cdb913e8691c8323bb8fd) @@ -2520,13 +2520,13 @@ String uuid = JsonUtil.optString(questionData, RestTags.QUESTION_UUID); // try to match the question to an existing QB question in DB - if (uuid != null) { + if (StringUtils.isNotBlank(uuid)) { qbQuestion = qbService.getQuestionByUUID(UUID.fromString(uuid)); } if (qbQuestion == null) { addToCollection = collection != null; - + qbQuestion = new QbQuestion(); qbQuestion.setType(QbQuestion.TYPE_MULTIPLE_CHOICE); qbQuestion.setQuestionId(qbService.generateNextQuestionId()); @@ -2547,7 +2547,7 @@ option.setName(optionDescription != null ? optionDescription.replaceAll("[\n\r\f]", "") : ""); option.setCorrect(JsonUtil.optBoolean(answerData, RestTags.CORRECT)); option.setDisplayOrder(JsonUtil.optInt(answerData, RestTags.DISPLAY_ORDER)); - option.setQbQuestion(item.getQbQuestion()); + option.setQbQuestion(qbQuestion); newOptions.add(option); } @@ -2561,7 +2561,7 @@ scratchieItemDao.insert(item); newItems.add(item); - // all questions need to end up in user's private collection + // all questions need to end up in user's private collection if (addToCollection) { qbService.addQuestionToCollection(collection.getUid(), qbQuestion.getQuestionId(), false); collectionUUIDs.add(uuid);