Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java,v diff -u -r1.10 -r1.11 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java 11 May 2016 07:53:40 -0000 1.10 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java 10 Oct 2016 12:56:00 -0000 1.11 @@ -119,7 +119,7 @@ protected String useSelectLeaderToolOuput; - protected String allowRateAnswers; + protected boolean allowRateAnswers; /** * @return Returns the usernameVisible. @@ -737,11 +737,11 @@ this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; } - public String getAllowRateAnswers() { + public boolean isAllowRateAnswers() { return allowRateAnswers; } - public void setAllowRateAnswers(String allowRateAnswers) { + public void setAllowRateAnswers(boolean allowRateAnswers) { this.allowRateAnswers = allowRateAnswers; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java,v diff -u -r1.79 -r1.80 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 13 Jul 2016 11:25:33 -0000 1.79 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 10 Oct 2016 12:56:00 -0000 1.80 @@ -164,6 +164,8 @@ void createQaContent(QaContent qa); void updateResponseVisibility(Long responseUid, boolean visible); + + boolean isRatingsEnabled(QaContent qaContent); QaQueUsr getUserByIdAndSession(final Long queUsrId, final Long qaSessionId); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java,v diff -u -r1.140 -r1.141 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 13 Jul 2016 11:25:33 -0000 1.140 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 10 Oct 2016 12:56:00 -0000 1.141 @@ -1075,6 +1075,22 @@ public boolean isCommentsEnabled(Long toolContentId) { return ratingService.isCommentsEnabled(toolContentId); } + + @Override + public boolean isRatingsEnabled(QaContent qaContent) { + //check if allow rate answers is ON and also that there is at least one non-comments rating criteria available + boolean allowRateAnswers = false; + if (qaContent.isAllowRateAnswers()) { + List ratingCriterias = getRatingCriterias(qaContent.getQaContentId()); + for (RatingCriteria ratingCriteria : ratingCriterias) { + if (!ratingCriteria.isCommentsEnabled()) { + allowRateAnswers = true; + break; + } + } + } + return allowRateAnswers; + } @Override public List getRatingCriteriaDtos(Long contentId, Collection itemIds, Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java,v diff -u -r1.30 -r1.31 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java 5 May 2016 08:10:37 -0000 1.30 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java 10 Oct 2016 12:56:00 -0000 1.31 @@ -111,7 +111,7 @@ boolean isNoToolSessions = qaService.isStudentActivityOccurredGlobal(content); request.getSession().setAttribute(QaAppConstants.IS_TOOL_SESSION_AVAILABLE, isNoToolSessions); - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, content); List listMonitoredAnswersContainerDTO = qaService.exportLearner(content, content.isUsernameVisible(), true, toolSessionID.toString(), userID.toString()); generalLearnerFlowDTO.setListMonitoredAnswersContainerDTO(listMonitoredAnswersContainerDTO); @@ -149,7 +149,7 @@ boolean isToolSessionAvailable = qaService.isStudentActivityOccurredGlobal(content); request.getSession().setAttribute(QaAppConstants.IS_TOOL_SESSION_AVAILABLE, isToolSessionAvailable); - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, content); request.getSession().setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "teacher"); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java,v diff -u -r1.56 -r1.57 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 11 May 2016 07:53:41 -0000 1.56 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 10 Oct 2016 12:56:00 -0000 1.57 @@ -61,7 +61,7 @@ qaLearningForm.setTotalQuestionCount(totalQuestionCount); } - public static GeneralLearnerFlowDTO buildGeneralLearnerFlowDTO(QaContent qaContent) { + public static GeneralLearnerFlowDTO buildGeneralLearnerFlowDTO(IQaService service, QaContent qaContent) { GeneralLearnerFlowDTO generalLearnerFlowDTO = new GeneralLearnerFlowDTO(); generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions()); @@ -78,9 +78,10 @@ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(qaContent.isAllowRichEditor()).toString()); generalLearnerFlowDTO .setUseSelectLeaderToolOuput(new Boolean(qaContent.isUseSelectLeaderToolOuput()).toString()); - generalLearnerFlowDTO.setAllowRateAnswers(new Boolean(qaContent.isAllowRateAnswers()).toString()); - generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQueContents().size())); + + //check if allow rate answers is ON and also that there is at least one non-comments rating criteria available + generalLearnerFlowDTO.setAllowRateAnswers(service.isRatingsEnabled(qaContent)); //create mapQuestions Map mapQuestions = new TreeMap(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java,v diff -u -r1.79 -r1.80 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 13 Jul 2016 11:25:33 -0000 1.79 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 10 Oct 2016 12:56:00 -0000 1.80 @@ -57,6 +57,7 @@ import org.lamsfoundation.lams.rating.dto.ItemRatingCriteriaDTO; import org.lamsfoundation.lams.rating.dto.ItemRatingDTO; import org.lamsfoundation.lams.rating.dto.RatingCommentDTO; +import org.lamsfoundation.lams.rating.model.RatingCriteria; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.qa.QaAppConstants; import org.lamsfoundation.lams.tool.qa.QaContent; @@ -127,7 +128,7 @@ return redirect; } - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); String totalQuestionCount = generalLearnerFlowDTO.getTotalQuestionCount().toString(); int intTotalQuestionCount = new Integer(totalQuestionCount).intValue(); @@ -309,7 +310,7 @@ QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue()); QaContent qaContent = qaSession.getQaContent(); - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); qaLearningForm.setCurrentQuestionIndex(new Integer(1).toString()); @@ -370,7 +371,7 @@ qaLearningForm.setSubmitAnswersContent(null); if (qaContent.isShowOtherAnswers()) { - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); String httpSessionID = qaLearningForm.getHttpSessionID(); generalLearnerFlowDTO.setHttpSessionID(httpSessionID); @@ -394,9 +395,6 @@ boolean allowRichEditor = qaContent.isAllowRichEditor(); generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString()); - - generalLearnerFlowDTO.setAllowRateAnswers(new Boolean(qaContent.isAllowRateAnswers()).toString()); - generalLearnerFlowDTO.setUserUid(user.getQueUsrId().toString()); int sessionUserCount = 0; @@ -458,7 +456,7 @@ QaContent qaContent = qaSession.getQaContent(); - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); String httpSessionID = qaLearningForm.getHttpSessionID(); qaLearningForm.setHttpSessionID(httpSessionID); @@ -499,8 +497,6 @@ boolean useSelectLeaderToolOuput = qaContent.isUseSelectLeaderToolOuput(); generalLearnerFlowDTO.setUseSelectLeaderToolOuput(new Boolean(useSelectLeaderToolOuput).toString()); - generalLearnerFlowDTO.setAllowRateAnswers(new Boolean(qaContent.isAllowRateAnswers()).toString()); - QaQueUsr qaQueUsr = getCurrentUser(toolSessionID); generalLearnerFlowDTO.setUserUid(qaQueUsr.getQueUsrId().toString()); @@ -557,7 +553,7 @@ return redirect; } - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); storeSequentialAnswer(qaLearningForm, request, generalLearnerFlowDTO, true); @@ -721,7 +717,7 @@ return redirect; } - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); storeSequentialAnswer(qaLearningForm, request, generalLearnerFlowDTO, false); @@ -818,7 +814,7 @@ QaLearningAction.qaService.updateEntry(notebookEntryLocal); - GeneralLearnerFlowDTO generalLearnerFlowDTO = new GeneralLearnerFlowDTO(); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); generalLearnerFlowDTO.setNotebookEntry(entryText); generalLearnerFlowDTO.setRequestLearningReportProgress(new Boolean(true).toString()); @@ -848,8 +844,6 @@ boolean useSelectLeaderToolOuput = qaContent.isUseSelectLeaderToolOuput(); generalLearnerFlowDTO.setUseSelectLeaderToolOuput(new Boolean(useSelectLeaderToolOuput).toString()); - generalLearnerFlowDTO.setAllowRateAnswers(new Boolean(qaContent.isAllowRateAnswers()).toString()); - NotebookEntry notebookEntry = QaLearningAction.qaService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, QaAppConstants.MY_SIGNATURE, new Integer(userID)); @@ -973,6 +967,7 @@ SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(httpSessionID); Long userId = user.getQueUsrId(); + Long toolContentId = qaContent.getQaContentId(); Set questions = qaContent.getQaQueContents(); generalLearnerFlowDTO.setQuestions(questions); generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString()); @@ -990,15 +985,10 @@ for (QaUsrResp responseIter : userResponses) { itemIds.add(responseIter.getResponseId()); } - List itemRatingDtos = qaService.getRatingCriteriaDtos(qaContent.getQaContentId(), itemIds, + List itemRatingDtos = qaService.getRatingCriteriaDtos(toolContentId, itemIds, true, userId); sessionMap.put(AttributeNames.ATTR_ITEM_RATING_DTOS, itemRatingDtos); - if (itemRatingDtos.size() > 0) { - commentsMinWordsLimit = itemRatingDtos.get(0).getCommentsMinWordsLimit(); - isCommentsEnabled = itemRatingDtos.get(0).isCommentsEnabled(); - } - //map itemRatingDto to corresponding response for (QaUsrResp response : userResponses) { @@ -1014,8 +1004,16 @@ response.setItemRatingDto(itemRatingDto); } + List ratingCriterias = qaService.getRatingCriterias(toolContentId); + for (RatingCriteria ratingCriteria : ratingCriterias) { + if (ratingCriteria.isCommentsEnabled()) { + isCommentsEnabled = true; + commentsMinWordsLimit = ratingCriteria.getCommentsMinWordsLimit(); + } + } + // store how many items are rated - countRatedQuestions = qaService.getCountItemsRatedByUser(qaContent.getQaContentId(), userId.intValue()); + countRatedQuestions = qaService.getCountItemsRatedByUser(toolContentId, userId.intValue()); } sessionMap.put("commentsMinWordsLimit", commentsMinWordsLimit); sessionMap.put("isCommentsEnabled", isCommentsEnabled); @@ -1138,7 +1136,7 @@ } } - boolean isItemAuthoredByUser = response.getQaQueUser().getUid().equals(userId); + boolean isItemAuthoredByUser = response.getQaQueUser().getQueUsrId().equals(userId); responseRow.put("isItemAuthoredByUser", isItemAuthoredByUser); JSONArray criteriasRows = new JSONArray(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java,v diff -u -r1.97 -r1.98 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 11 May 2016 07:53:41 -0000 1.97 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 10 Oct 2016 12:56:00 -0000 1.98 @@ -183,7 +183,7 @@ sessionMap.put(ATTR_CONTENT, qaContent); sessionMap.put(AttributeNames.USER, user); - GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent); generalLearnerFlowDTO.setUserUid(user.getQueUsrId().toString()); generalLearnerFlowDTO.setHttpSessionID(sessionMapId); generalLearnerFlowDTO.setToolSessionID(toolSessionID); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java,v diff -u -r1.73 -r1.74 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 11 May 2016 07:53:41 -0000 1.73 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 10 Oct 2016 12:56:00 -0000 1.74 @@ -137,8 +137,12 @@ boolean isGroupedActivity = qaService.isGroupedActivity(qaContent.getQaContentId()); request.setAttribute("isGroupedActivity", isGroupedActivity); + + //ratings stuff + boolean isRatingsEnabled = qaService.isRatingsEnabled(qaContent); + request.setAttribute("isRatingsEnabled", isRatingsEnabled); - //rating stuff + //comments stuff boolean isCommentsEnabled = qaService.isCommentsEnabled(qaContent.getQaContentId()); request.setAttribute("isCommentsEnabled", isCommentsEnabled); Index: lams_tool_laqa/web/learning/LearnerRep.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/learning/LearnerRep.jsp,v diff -u -r1.67 -r1.68 --- lams_tool_laqa/web/learning/LearnerRep.jsp 8 Apr 2016 13:05:53 -0000 1.67 +++ lams_tool_laqa/web/learning/LearnerRep.jsp 10 Oct 2016 12:56:00 -0000 1.68 @@ -112,7 +112,7 @@ var usesRatings = false; var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -266,7 +266,7 @@ - +
@@ -333,7 +333,7 @@
<%--Rating area---------------------------------------%> - +
@@ -367,7 +367,7 @@ - + Index: lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp,v diff -u -r1.46 -r1.47 --- lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp 8 Apr 2016 13:05:53 -0000 1.46 +++ lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp 10 Oct 2016 12:56:00 -0000 1.47 @@ -116,7 +116,7 @@ var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -270,7 +270,7 @@ - +
@@ -334,7 +334,7 @@
<%--Rating area---------------------------------------%> - +
@@ -378,7 +378,7 @@ - + Index: lams_tool_laqa/web/learning/mobile/LearnerRep.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/learning/mobile/LearnerRep.jsp,v diff -u -r1.24 -r1.25 --- lams_tool_laqa/web/learning/mobile/LearnerRep.jsp 8 Apr 2016 13:05:53 -0000 1.24 +++ lams_tool_laqa/web/learning/mobile/LearnerRep.jsp 10 Oct 2016 12:56:00 -0000 1.25 @@ -119,7 +119,7 @@ var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -276,7 +276,7 @@ - +
@@ -360,7 +360,7 @@
<%--Rating area---------------------------------------%> - +
@@ -398,7 +398,7 @@ - + Index: lams_tool_laqa/web/learning/mobile/RevisitedLearnerRep.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/learning/mobile/RevisitedLearnerRep.jsp,v diff -u -r1.25 -r1.26 --- lams_tool_laqa/web/learning/mobile/RevisitedLearnerRep.jsp 8 Apr 2016 13:05:53 -0000 1.25 +++ lams_tool_laqa/web/learning/mobile/RevisitedLearnerRep.jsp 10 Oct 2016 12:56:00 -0000 1.26 @@ -119,7 +119,7 @@ var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -276,7 +276,7 @@ - +
@@ -338,7 +338,7 @@
<%--Rating area---------------------------------------%> - +
@@ -387,7 +387,7 @@ - + Index: lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp,v diff -u -r1.52 -r1.53 --- lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 13 Jul 2016 11:25:33 -0000 1.52 +++ lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 10 Oct 2016 12:56:00 -0000 1.53 @@ -202,7 +202,7 @@ rows += ''; - if (${qaContent.allowRateAnswers}) { + if (${isRatingsEnabled}) { rows += ''; if (userData["visible"] == 'true') { Index: lams_tool_laqa/web/monitoring/SummaryContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/SummaryContent.jsp,v diff -u -r1.49 -r1.50 --- lams_tool_laqa/web/monitoring/SummaryContent.jsp 23 Feb 2016 04:05:52 -0000 1.49 +++ lams_tool_laqa/web/monitoring/SummaryContent.jsp 10 Oct 2016 12:56:00 -0000 1.50 @@ -50,7 +50,7 @@ - +