Index: lams_build/build_base.xml =================================================================== diff -u -r8cbac4322030e82a51acc1456d8efdc3fcbcc464 -r6411752240af51ee25e8173ab87d6458866bf2b4 --- lams_build/build_base.xml (.../build_base.xml) (revision 8cbac4322030e82a51acc1456d8efdc3fcbcc464) +++ lams_build/build_base.xml (.../build_base.xml) (revision 6411752240af51ee25e8173ab87d6458866bf2b4) @@ -41,7 +41,6 @@ - @@ -55,6 +54,8 @@ + + Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java =================================================================== diff -u -re0f0bfaf1b029e6241352c307a86381e9c5faf42 -r6411752240af51ee25e8173ab87d6458866bf2b4 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision e0f0bfaf1b029e6241352c307a86381e9c5faf42) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision 6411752240af51ee25e8173ab87d6458866bf2b4) @@ -21,7 +21,6 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.assessment.web.action; import java.io.IOException; @@ -54,8 +53,6 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionRedirect; -import org.apache.tomcat.util.json.JSONException; -import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.learning.web.bean.ActivityPositionDTO; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.notebook.model.NotebookEntry; @@ -88,6 +85,9 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; + /** * @author Andrey Balan */ @@ -98,7 +98,7 @@ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, IllegalAccessException, - InstantiationException, InvocationTargetException, NoSuchMethodException, JSONException { + InstantiationException, InvocationTargetException, NoSuchMethodException { String param = mapping.getParameter(); if (param.equals("start")) { @@ -137,7 +137,7 @@ if (param.equals("getSecondsLeft")) { return getSecondsLeft(mapping, form, request, response); } - + // ================ Reflection ======================= if (param.equals("newReflection")) { return newReflection(mapping, form, request, response); @@ -161,7 +161,7 @@ InvocationTargetException, NoSuchMethodException { // initialize Session Map - SessionMap sessionMap = new SessionMap(); + SessionMap sessionMap = new SessionMap<>(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); // save toolContentID into HTTPSession @@ -201,22 +201,25 @@ return mapping.findForward(AssessmentConstants.WAIT_FOR_LEADER); } - + // forwards to the waitForLeader pages boolean isNonLeader = !user.getUserId().equals(groupLeader.getUserId()); if (assessment.getTimeLimit() != 0 && isNonLeader && !user.isSessionFinished()) { - AssessmentResult lastLeaderResult = service.getLastAssessmentResult(assessment.getUid(), groupLeader.getUserId()); + AssessmentResult lastLeaderResult = service.getLastAssessmentResult(assessment.getUid(), + groupLeader.getUserId()); //show waitForLeaderLaunchTimeLimit page if the leader hasn't started activity or hasn't pressed OK button to launch time limit if (lastLeaderResult == null || lastLeaderResult.getTimeLimitLaunchedDate() == null) { - request.setAttribute(AssessmentConstants.PARAM_WAITING_MESSAGE_KEY, "label.waiting.for.leader.launch.time.limit"); + request.setAttribute(AssessmentConstants.PARAM_WAITING_MESSAGE_KEY, + "label.waiting.for.leader.launch.time.limit"); return mapping.findForward(AssessmentConstants.WAIT_FOR_LEADER_TIME_LIMIT); - } - + } + //if the time is up and leader hasn't submitted response - show waitForLeaderFinish page boolean isTimeLimitExceeded = service.checkTimeLimitExceeded(assessment, groupLeader); if (isTimeLimitExceeded && !groupLeader.isSessionFinished()) { - request.setAttribute(AssessmentConstants.PARAM_WAITING_MESSAGE_KEY, "label.waiting.for.leader.finish"); + request.setAttribute(AssessmentConstants.PARAM_WAITING_MESSAGE_KEY, + "label.waiting.for.leader.finish"); return mapping.findForward(AssessmentConstants.WAIT_FOR_LEADER_TIME_LIMIT); } } @@ -234,10 +237,10 @@ boolean isUserLeader = service.isUserGroupLeader(user, new Long(toolSessionId)); sessionMap.put(AssessmentConstants.ATTR_IS_USER_LEADER, isUserLeader); - Set questionReferences = new TreeSet(new SequencableComparator()); + Set questionReferences = new TreeSet<>(new SequencableComparator()); questionReferences.addAll(assessment.getQuestionReferences()); - HashMap questionToReferenceMap = new HashMap(); - ArrayList takenQuestion = new ArrayList(); + HashMap questionToReferenceMap = new HashMap<>(); + ArrayList takenQuestion = new ArrayList<>(); //add non-random questions for (QuestionReference questionReference : questionReferences) { @@ -292,7 +295,7 @@ sessionMap.put(AssessmentConstants.ATTR_REFLECTION_ON, assessment.isReflectOnActivity()); sessionMap.put(AssessmentConstants.ATTR_REFLECTION_INSTRUCTION, assessment.getReflectInstructions()); sessionMap.put(AssessmentConstants.ATTR_REFLECTION_ENTRY, entryText); - + //time limit boolean isTimeLimitEnabled = hasEditRight && !showResults && assessment.getTimeLimit() != 0; long secondsLeft = isTimeLimitEnabled ? service.getSecondsLeft(assessment, user) : 0; @@ -328,10 +331,10 @@ } //sort questions - LinkedList questionDtos = new LinkedList(); + LinkedList questionDtos = new LinkedList<>(); for (QuestionReference questionReference : questionReferences) { AssessmentQuestion question = questionToReferenceMap.get(questionReference.getUid()); - + QuestionDTO questionDto = question.getQuestionDTO(); questionDto.setGrade(questionReference.getDefaultGrade()); @@ -340,45 +343,45 @@ // shuffling if (assessment.isShuffled()) { - ArrayList shuffledList = new ArrayList(questionDtos); + ArrayList shuffledList = new ArrayList<>(questionDtos); Collections.shuffle(shuffledList); - questionDtos = new LinkedList(shuffledList); + questionDtos = new LinkedList<>(shuffledList); } - for (QuestionDTO questionDto : questionDtos) { + for (QuestionDTO questionDto : questionDtos) { if (questionDto.isShuffle() || (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING)) { - ArrayList shuffledList = new ArrayList(questionDto.getOptionDtos()); + ArrayList shuffledList = new ArrayList<>(questionDto.getOptionDtos()); Collections.shuffle(shuffledList); - questionDto.setOptionDtos(new LinkedHashSet(shuffledList)); + questionDto.setOptionDtos(new LinkedHashSet<>(shuffledList)); } if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { //sort answer options alphanumerically (as per LDEV-4326) - ArrayList optionsSortedByOptionString = new ArrayList( - questionDto.getOptionDtos()); + ArrayList optionsSortedByOptionString = new ArrayList<>(questionDto.getOptionDtos()); optionsSortedByOptionString.sort(new Comparator() { @Override public int compare(OptionDTO o1, OptionDTO o2) { String optionString1 = o1.getOptionString() != null ? o1.getOptionString() : ""; String optionString2 = o2.getOptionString() != null ? o2.getOptionString() : ""; - + return AlphanumComparator.compareAlphnumerically(optionString1, optionString2); } }); - questionDto.setMatchingPairOptions(new LinkedHashSet(optionsSortedByOptionString)); + questionDto.setMatchingPairOptions(new LinkedHashSet<>(optionsSortedByOptionString)); } } //paging - List> pagedQuestionDtos = new ArrayList>(); + List> pagedQuestionDtos = new ArrayList<>(); int maxQuestionsPerPage = ((assessment.getQuestionsPerPage() != 0) && hasEditRight) - ? assessment.getQuestionsPerPage() : questionDtos.size(); - LinkedHashSet questionsForOnePage = new LinkedHashSet(); + ? assessment.getQuestionsPerPage() + : questionDtos.size(); + LinkedHashSet questionsForOnePage = new LinkedHashSet<>(); pagedQuestionDtos.add(questionsForOnePage); int count = 0; for (QuestionDTO questionDto : questionDtos) { questionsForOnePage.add(questionDto); count++; if ((questionsForOnePage.size() == maxQuestionsPerPage) && (count != questionDtos.size())) { - questionsForOnePage = new LinkedHashSet(); + questionsForOnePage = new LinkedHashSet<>(); pagedQuestionDtos.add(questionsForOnePage); } } @@ -390,7 +393,7 @@ // loadupLastAttempt for display purpose loadupLastAttempt(sessionMap); - + if (showResults) { // display results page @@ -406,12 +409,12 @@ return mapping.findForward(AssessmentConstants.LEARNING); } } - + /** * Checks Leader Progress */ private ActionForward checkLeaderProgress(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException { + HttpServletResponse response) throws IOException { IAssessmentService service = getAssessmentService(); Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); @@ -423,32 +426,36 @@ boolean isTimeLimitExceeded = service.checkTimeLimitExceeded(session.getAssessment(), leader); boolean isLeaderResponseFinalized = leader.isSessionFinished(); - JSONObject JSONObject = new JSONObject(); - JSONObject.put("isPageRefreshRequested", isLeaderResponseFinalized || isTimeLimitExceeded); + ObjectNode ObjectNode = JsonNodeFactory.instance.objectNode(); + ObjectNode.put("isPageRefreshRequested", isLeaderResponseFinalized || isTimeLimitExceeded); response.setContentType("application/x-json;charset=utf-8"); - response.getWriter().print(JSONObject); + response.getWriter().print(ObjectNode); return null; } /** * Shows next page. It's available only to leaders as non-leaders see all questions on one page. - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ private ActionForward nextPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { + HttpServletResponse response) + throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { return nextPage(mapping, request, false, -1); } - + /** * Auxiliary method to be called by nextPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, - * HttpServletResponse response) or submitAll. + * HttpServletResponse response) or submitAll. * * @param mapping * @param request - * @param isAnswersValidationFailed submitAll() method may set it as true in case some of the pages miss required answers - * @param pageNumberWithUnasweredQuestions page number with questions required to be answered + * @param isAnswersValidationFailed + * submitAll() method may set it as true in case some of the pages miss required answers + * @param pageNumberWithUnasweredQuestions + * page number with questions required to be answered * @return */ private ActionForward nextPage(ActionMapping mapping, HttpServletRequest request, boolean isAnswersValidationFailed, @@ -484,7 +491,7 @@ if (showResults) { request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); return mapping.findForward(AssessmentConstants.SHOW_RESULTS); - + } else { //get user answers from request and store them into sessionMap storeUserAnswersIntoSessionMap(request, oldPageNumber); @@ -493,7 +500,7 @@ long secondsLeft = service.getSecondsLeft(assessment, user); sessionMap.put(AssessmentConstants.ATTR_SECONDS_LEFT, secondsLeft); - + // use redirect to prevent form resubmission ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(AssessmentConstants.LEARNING)); redirect.addParameter(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); @@ -506,13 +513,14 @@ * Ajax call to get the remaining seconds. Needed when the page is reloaded in the browser to check with the server * what the current values should be! Otherwise the learner can keep hitting reload after a page change or submit * all (when questions are spread across pages) and increase their time! + * * @return - * @throws JSONException - * @throws IOException + * @throws JSONException + * @throws IOException */ private ActionForward getSecondsLeft(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, JSONException, IOException { + HttpServletResponse response) throws ServletException, IllegalAccessException, InvocationTargetException, + NoSuchMethodException, IOException { IAssessmentService service = getAssessmentService(); String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); @@ -521,21 +529,23 @@ Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT); AssessmentUser user = (AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER); long secondsLeft = service.getSecondsLeft(assessment, user); - JSONObject JSONObject = new JSONObject(); - JSONObject.put(AssessmentConstants.ATTR_SECONDS_LEFT, secondsLeft); + ObjectNode responseJSON = JsonNodeFactory.instance.objectNode(); + responseJSON.put(AssessmentConstants.ATTR_SECONDS_LEFT, secondsLeft); response.setContentType("application/x-json;charset=utf-8"); - response.getWriter().print(JSONObject); - return null; + response.getWriter().print(responseJSON); + return null; } /** * Handling submittion of MarkHedging type of Questions (in case of leader aware tool). - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ private ActionForward submitSingleMarkHedgingQuestion(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { + HttpServletRequest request, HttpServletResponse response) + throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { IAssessmentService service = getAssessmentService(); String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() @@ -552,7 +562,8 @@ // store results from sessionMap into DB Long singleMarkHedgingQuestionUid = WebUtil.readLongParam(request, "singleMarkHedgingQuestionUid"); - boolean isResultsStored = service.storeUserAnswers(assessment, userId, pagedQuestionDtos, singleMarkHedgingQuestionUid, false); + boolean isResultsStored = service.storeUserAnswers(assessment, userId, pagedQuestionDtos, + singleMarkHedgingQuestionUid, false); // result was not stored in case user was prohibited from submitting (or autosubmitting) answers (e.g. when // using 2 browsers). Then show last stored results if (!isResultsStored) { @@ -585,12 +596,14 @@ /** * Display same entire authoring page content from HttpSession variable. - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ private ActionForward submitAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { + HttpServletResponse response) + throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); @@ -622,7 +635,7 @@ // populate info for displaying results page showResults(mapping, sessionMap); - + //use redirect to prevent form resubmission ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(AssessmentConstants.SHOW_RESULTS)); redirect.addParameter(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); @@ -645,20 +658,20 @@ AssessmentUser assessmentUser = (AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER); Long userId = assessmentUser.getUserId(); service.unsetSessionFinished(toolSessionId, userId); - + Date lastAttemptStartingDate = service.getLastAssessmentResult(assessment.getUid(), userId).getStartDate(); - + // set attempt started: create a new one + mark previous as not being the latest any longer service.setAttemptStarted(assessment, assessmentUser, toolSessionId); - + // in case of content was modified in monitor - redirect to start.do in order to refresh info from the DB if (assessment.isContentModifiedInMonitor(lastAttemptStartingDate)) { ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learningStartMethod")); redirect.addParameter(AttributeNames.PARAM_MODE, mode.toString()); redirect.addParameter(AssessmentConstants.PARAM_TOOL_SESSION_ID, toolSessionId); return redirect; - - //otherwise use data from SessionMap + + //otherwise use data from SessionMap } else { sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, false); @@ -743,7 +756,7 @@ int optionIndex = NumberUtils.stringToInt(request.getParameter(AssessmentConstants.PARAM_OPTION_INDEX), -1); if (optionIndex != -1) { - List rList = new ArrayList(optionDtoList); + List rList = new ArrayList<>(optionDtoList); // get current and the target item, and switch their sequnece OptionDTO option = rList.remove(optionIndex); @@ -754,7 +767,7 @@ } // put back list - optionDtoList = new LinkedHashSet(rList); + optionDtoList = new LinkedHashSet<>(rList); questionDto.setOptionDtos(optionDtoList); } @@ -765,12 +778,14 @@ /** * auto saves responses - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ private ActionForward autoSaveAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + HttpServletResponse response) + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { IAssessmentService service = getAssessmentService(); String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() @@ -784,7 +799,7 @@ return null; } - + /** * Stores date when user has started activity with time limit */ @@ -794,11 +809,11 @@ String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); - + Long assessmentUid = ((Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT)).getUid(); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); sessionMap.put(AssessmentConstants.ATTR_IS_TIME_LIMIT_NOT_LAUNCHED, false); - + service.launchTimeLimit(assessmentUid, userId); return null; @@ -873,7 +888,8 @@ * Get back user answers from request and store it into sessionMap. * * @param request - * @param pageNumber number of the page to process + * @param pageNumber + * number of the page to process */ private void storeUserAnswersIntoSessionMap(HttpServletRequest request, int pageNumber) { String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); @@ -992,7 +1008,8 @@ int questionType = questionDto.getType(); //enforce all hedging marks question type to be answered as well - if (questionDto.isAnswerRequired() || (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING)) { + if (questionDto.isAnswerRequired() + || (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING)) { boolean isAnswered = false; @@ -1042,13 +1059,14 @@ if ((questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ESSAY) && (questionDto.getMinWordsLimit() > 0)) { - if ( questionDto.getAnswerString() == null ) { + if (questionDto.getAnswerString() == null) { isAllQuestionsReachedMinWordsLimit = false; break; - + } else { - boolean isMinWordsLimitReached = ValidationUtil.isMinWordsLimitReached(questionDto.getAnswerString(), - questionDto.getMinWordsLimit(), questionDto.isAllowRichEditor()); + boolean isMinWordsLimitReached = ValidationUtil.isMinWordsLimitReached( + questionDto.getAnswerString(), questionDto.getMinWordsLimit(), + questionDto.isAllowRichEditor()); // check min words limit is reached if (!isMinWordsLimitReached) { isAllQuestionsReachedMinWordsLimit = false; @@ -1077,7 +1095,7 @@ Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); IAssessmentService service = getAssessmentService(); - + int dbResultCount = service.getAssessmentResultCount(assessment.getUid(), userId); if (dbResultCount > 0) { @@ -1197,7 +1215,7 @@ questionDto.setPenalty(questionResult.getPenalty()); for (OptionDTO optionDto : questionDto.getOptionDtos()) { - + for (AssessmentOptionAnswer optionAnswer : questionResult.getOptionAnswers()) { if (optionDto.getUid().equals(optionAnswer.getOptionUid())) { optionDto.setAnswerBoolean(optionAnswer.getAnswerBoolean()); @@ -1209,7 +1227,7 @@ //sort ordering type of question in order to show how learner has sorted them if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { - + //don't sort ordering type of questions that haven't been submitted to not break their shuffled order boolean isOptionAnswersNeverSubmitted = true; for (OptionDTO optionDto : questionDto.getOptionDtos()) { @@ -1219,7 +1237,7 @@ } if (!isOptionAnswersNeverSubmitted) { - TreeSet orderedSet = new TreeSet(new AnswerIntComparator()); + TreeSet orderedSet = new TreeSet<>(new AnswerIntComparator()); orderedSet.addAll(questionDto.getOptionDtos()); questionDto.setOptionDtos(orderedSet); } @@ -1245,20 +1263,22 @@ /** * Store user answers in DB in last unfinished attempt and notify teachers about it. - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ - private boolean storeUserAnswersIntoDatabase(SessionMap sessionMap, boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - + private boolean storeUserAnswersIntoDatabase(SessionMap sessionMap, boolean isAutosave) + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + List> pagedQuestionDtos = (List>) sessionMap .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); IAssessmentService service = getAssessmentService(); Long toolSessionId = (Long) sessionMap.get(AssessmentConstants.ATTR_TOOL_SESSION_ID); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); Assessment assessment = service.getAssessmentBySessionId(toolSessionId); - + boolean isResultsStored = service.storeUserAnswers(assessment, userId, pagedQuestionDtos, null, isAutosave); // notify teachers @@ -1298,8 +1318,8 @@ private AssessmentUser getSpecifiedUser(IAssessmentService service, Long sessionId, Integer userId) { AssessmentUser assessmentUser = service.getUserByIDAndSession(new Long(userId.intValue()), sessionId); if (assessmentUser == null) { - LearningAction.log - .error("Unable to find specified user for assessment activity. Screens are likely to fail. SessionId=" + LearningAction.log.error( + "Unable to find specified user for assessment activity. Screens are likely to fail. SessionId=" + sessionId + " UserId=" + userId); } return assessmentUser;