Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java =================================================================== diff -u -r8522cd628329e0031e21b48f2750b1fd9b1842a6 -r0f29639d502d808fe728f426312644ed5f6282fc --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java (.../ExportServlet.java) (revision 8522cd628329e0031e21b48f2750b1fd9b1842a6) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java (.../ExportServlet.java) (revision 0f29639d502d808fe728f426312644ed5f6282fc) @@ -105,16 +105,11 @@ McSession mcSession=mcService.retrieveMcSession(toolSessionID); + // If the learner hasn't selected any options yet, then they won't exist in the session. + // Yet we might be asked for their page, as the activity has been commenced. So need to do a "blank" page in that case McQueUsr learner = mcService.getMcUserBySession(userID,mcSession.getUid()); logger.debug("learner: " + learner); - if (learner == null) - { - String error="The user with user id " + userID + " does not exist in this session or session may not exist."; - logger.error(error); - throw new McApplicationException(error); - } - McContent content=mcSession.getMcContent(); logger.debug("content: " + content); logger.debug("content id: " + content.getMcContentId()); @@ -125,22 +120,20 @@ logger.error(error); throw new McApplicationException(error); } - - McMonitoringAction mcMonitoringAction= new McMonitoringAction(); List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionDataForExportLearner(request, content, mcService, mcSession, learner ); request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO); logger.debug("LIST_MONITORED_ANSWERS_CONTAINER_DTO: " + request.getSession().getAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO)); + if ( learner != null ) { + String intTotalMark=viewAnswers(request, content, learner, mcSession, mcService); + logger.debug("intTotalMark: " + intTotalMark); + request.getSession().setAttribute(LEARNER_MARK,intTotalMark); + request.getSession().setAttribute(LEARNER_NAME,learner.getFullname() ); + } - String intTotalMark=viewAnswers(request, content, learner, mcSession, mcService); - logger.debug("intTotalMark: " + intTotalMark); - - request.getSession().setAttribute(LEARNER_MARK,intTotalMark); - request.getSession().setAttribute(LEARNER_NAME,learner.getFullname() ); request.getSession().setAttribute(PASSMARK,content.getPassMark().toString()); - request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "learner"); mcMonitoringAction.prepareReflectionData(request, content, mcService, userID.toString(), true); logger.debug("ending learner mode: ");