Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== diff -u -r731ac9bda6562e241a71eb71b18caeaa49aeefb5 -r9d0d81c8d1348fd8eaf2da0bc713621459a47718 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision 731ac9bda6562e241a71eb71b18caeaa49aeefb5) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision 9d0d81c8d1348fd8eaf2da0bc713621459a47718) @@ -1404,15 +1404,15 @@ //adding if (previousOptionUid.equals(-1L)) { - //search for duplicates and, if found, return false + //search for duplicates and, if found, return false for (QbOption option : qbQuestion.getQbOptions()) { String name = option.getName(); String[] alternatives = name.split("\r\n"); if (Arrays.asList(alternatives).contains(answer)) { - return Optional.of(option.getUid()); + return Optional.of(option.getUid()); } } - + for (QbOption targetOption : qbQuestion.getQbOptions()) { if (targetOption.getUid().equals(targetOptionUid)) { String name = targetOption.getName(); @@ -1532,7 +1532,7 @@ //recalculate marks in all Scratchie activities, that use modified QbQuestion toolService.recalculateScratchieMarksForVsaQuestion(qbQuestion.getUid()); } - + return Optional.empty(); } @@ -2202,7 +2202,7 @@ Double correctPercentage = total == 0 || summaryOfAnswers.get(trueKey) == null ? 0 : (double) summaryOfAnswers.get(trueKey) / total; ExcelCell correctCell = summaryTableRow.addPercentageCell(correctPercentage); - + Double wrongPercentage = total == 0 || summaryOfAnswers.get(falseKey) == null ? 0 : (double) summaryOfAnswers.get(falseKey) / total; ExcelCell wrongCell = summaryTableRow.addPercentageCell(wrongPercentage); @@ -2852,7 +2852,7 @@ } toolContentObj.setCreatedBy(user); - long publicQbCollectionUid = qbService.getPublicCollection().getUid(); + long userQbCollectionUid = qbService.getUserPrivateCollection(newUserUid).getUid(); // we need to save QB questions and options first for (AssessmentQuestion assessmentQuestion : toolContentObj.getQuestions()) { @@ -2863,7 +2863,7 @@ if (existingQuestion == null) { // none found, create a new QB question qbService.insertQuestion(qbQuestion); - qbService.addQuestionToCollection(publicQbCollectionUid, qbQuestion.getQuestionId(), false); + qbService.addQuestionToCollection(userQbCollectionUid, qbQuestion.getQuestionId(), false); } else { // found, use the existing one assessmentQuestion.setQbQuestion(existingQuestion); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java =================================================================== diff -u -r1dc5f5ec294283f43ce1deaa33066bdf1190ff1d -r9d0d81c8d1348fd8eaf2da0bc713621459a47718 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java (.../McService.java) (revision 1dc5f5ec294283f43ce1deaa33066bdf1190ff1d) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McService.java (.../McService.java) (revision 9d0d81c8d1348fd8eaf2da0bc713621459a47718) @@ -1067,7 +1067,7 @@ cell.setCellStyle(greenColor); } CellUtil.setCellStyleProperty(cell, CellUtil.DATA_FORMAT, percentageFormat); - + totalPercentage += percentage; } cell = row.createCell(maxOptionsInQuestion + 1); @@ -1164,7 +1164,9 @@ cell = row.createCell(count++); cell.setCellValue(new Long(userMark.getTotalMark())); - Double totalPercents = questions.size() != 0 ? (double) numberOfCorrectlyAnsweredByUser / questions.size() : 0d; + Double totalPercents = questions.size() != 0 + ? (double) numberOfCorrectlyAnsweredByUser / questions.size() + : 0d; totalPercentList.add(totalPercents); cell = row.createCell(count++); cell.setCellValue(totalPercents); @@ -1181,7 +1183,8 @@ cell.setCellValue(messageService.getMessage("label.ave")); for (int numberOfCorrectAnswers : numberOfCorrectAnswersPerQuestion) { cell = row.createCell(count++); - Double average = totalPercentList.size() == 0 ? 0d : (double) numberOfCorrectAnswers / totalPercentList.size(); + Double average = totalPercentList.size() == 0 ? 0d + : (double) numberOfCorrectAnswers / totalPercentList.size(); cell.setCellValue(average); CellUtil.setCellStyleProperty(cell, CellUtil.DATA_FORMAT, percentageFormat); } @@ -1440,7 +1443,7 @@ toolContentObj.setMcContentId(toolContentId); toolContentObj.setCreatedBy(newUserUid); - long publicQbCollectionUid = qbService.getPublicCollection().getUid(); + long userQbCollectionUid = qbService.getUserPrivateCollection(newUserUid).getUid(); // we need to save QB questions and options first for (McQueContent mcQuestion : toolContentObj.getMcQueContents()) { @@ -1452,7 +1455,7 @@ if (existingQuestion == null) { // none found, create a new QB question qbService.insertQuestion(qbQuestion); - qbService.addQuestionToCollection(publicQbCollectionUid, qbQuestion.getQuestionId(), false); + qbService.addQuestionToCollection(userQbCollectionUid, qbQuestion.getQuestionId(), false); } else { // found, use the existing one mcQuestion.setQbQuestion(existingQuestion); @@ -2205,7 +2208,7 @@ mcContent.setTitle(newActivityName); mcContentDAO.updateMcContent(mcContent); } - + // remove all existing questions for (McQueContent mcQuestion : mcContent.getMcQueContents()) { mcQueContentDAO.delete(mcQuestion); @@ -2220,7 +2223,7 @@ mcQueContentDAO.insert(mcQuestion); } } - + @Override public void setConfigValue(String key, String value) { mcConfigDAO.setConfigValue(key, value); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaService.java =================================================================== diff -u -r02ce40b60524aa33d326fbda824dcd43f566ab94 -r9d0d81c8d1348fd8eaf2da0bc713621459a47718 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaService.java (.../QaService.java) (revision 02ce40b60524aa33d326fbda824dcd43f566ab94) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaService.java (.../QaService.java) (revision 9d0d81c8d1348fd8eaf2da0bc713621459a47718) @@ -613,7 +613,7 @@ } } - long publicQbCollectionUid = qbService.getPublicCollection().getUid(); + long userQbCollectionUid = qbService.getUserPrivateCollection(newUserUid).getUid(); Set questions = toolContentObj.getQaQueContents(); for (QaQueContent question : questions) { @@ -628,7 +628,7 @@ if (existingQuestion == null) { // none found, create a new QB question qbService.insertQuestion(qbQuestion); - qbService.addQuestionToCollection(publicQbCollectionUid, qbQuestion.getQuestionId(), false); + qbService.addQuestionToCollection(userQbCollectionUid, qbQuestion.getQuestionId(), false); } else { // found, use the existing one question.setQbQuestion(existingQuestion); Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -r7fdda695e029753cdb6cbd771cf897080afc942c -r9d0d81c8d1348fd8eaf2da0bc713621459a47718 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 7fdda695e029753cdb6cbd771cf897080afc942c) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 9d0d81c8d1348fd8eaf2da0bc713621459a47718) @@ -1588,7 +1588,7 @@ GroupSummary allTeamSummary = itemSummary.get(0); Collection optionDtos = allTeamSummary.getOptionDtos(); - + row = researchAndAnalysisSheet.initRow(); row.addEmptyCell(); for (int i = 0; i < optionDtos.size(); i++) { @@ -1626,7 +1626,7 @@ row = researchAndAnalysisSheet.initRow(); row.addCell(groupSummary.getSessionName(), true); - + int longestRowLength = 0; if (isMcqItem) { longestRowLength = optionDtos.size(); @@ -1688,15 +1688,16 @@ for (ScratchieItem item : items) { boolean isMcqItem = item.getQbQuestion().getType() == QbQuestion.TYPE_MULTIPLE_CHOICE; - - //build list of all logs left for this item and this session + + //build list of all logs left for this item and this session List logsBySessionAndItem = new ArrayList<>(); for (ScratchieAnswerVisitLog log : logs) { - if (log.getSessionId().equals(sessionId) && log.getQbToolQuestion().getUid().equals(item.getUid())) { + if (log.getSessionId().equals(sessionId) + && log.getQbToolQuestion().getUid().equals(item.getUid())) { logsBySessionAndItem.add(log); } } - + row = researchAndAnalysisSheet.initRow(); row.addCell(getMessage("label.question.semicolon", new Object[] { item.getQbQuestion().getName() }), false); @@ -1728,7 +1729,7 @@ if (item.getOptionDtos().size() > maxLogCount) { maxLogCount = item.getOptionDtos().size(); } - + //search for max value in logs length for (GroupSummary summary : summaryByTeam) { Long sessionId = summary.getSessionId(); @@ -1740,7 +1741,7 @@ logsBySessionAndItem++; } } - + if (logsBySessionAndItem > maxLogCount) { maxLogCount = logsBySessionAndItem; } @@ -1818,10 +1819,11 @@ Object mark = (itemDto.getUserMark() == -1) ? "" : Long.valueOf(itemDto.getUserMark()); row.addCell(mark); - //build list of all logs left for this item and this session + //build list of all logs left for this item and this session List logsBySessionAndItem = new ArrayList<>(); for (ScratchieAnswerVisitLog log : logs) { - if (log.getSessionId().equals(sessionId) && log.getQbToolQuestion().getUid().equals(itemDto.getUid())) { + if (log.getSessionId().equals(sessionId) + && log.getQbToolQuestion().getUid().equals(itemDto.getUid())) { logsBySessionAndItem.add(log); } } @@ -2230,7 +2232,7 @@ user.setUserId(newUserUid.longValue()); } - long publicQbCollectionUid = qbService.getPublicCollection().getUid(); + long userQbCollectionUid = qbService.getUserPrivateCollection(newUserUid).getUid(); // we need to save QB questions and options first for (ScratchieItem scratchieItem : toolContentObj.getScratchieItems()) { @@ -2242,7 +2244,7 @@ if (existingQuestion == null) { // none found, create a new QB question qbService.insertQuestion(qbQuestion); - qbService.addQuestionToCollection(publicQbCollectionUid, qbQuestion.getQuestionId(), false); + qbService.addQuestionToCollection(userQbCollectionUid, qbQuestion.getQuestionId(), false); } else { // found, use the existing one scratchieItem.setQbQuestion(existingQuestion);