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.6.2.5 -r1.6.2.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java 11 May 2016 07:35:58 -0000 1.6.2.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java 11 Oct 2016 05:20:42 -0000 1.6.2.6 @@ -116,7 +116,7 @@ protected String useSelectLeaderToolOuput; - protected String allowRateAnswers; + protected boolean allowRateAnswers; /** * @return Returns the usernameVisible. @@ -718,11 +718,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.66.2.11 -r1.66.2.12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 14 Jul 2016 05:37:47 -0000 1.66.2.11 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 11 Oct 2016 05:20:42 -0000 1.66.2.12 @@ -162,6 +162,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.111.2.27 -r1.111.2.28 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 14 Jul 2016 05:37:47 -0000 1.111.2.27 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 11 Oct 2016 05:20:42 -0000 1.111.2.28 @@ -845,6 +845,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/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java,v diff -u -r1.51.2.5 -r1.51.2.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 11 May 2016 07:36:00 -0000 1.51.2.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 11 Oct 2016 05:20:42 -0000 1.51.2.6 @@ -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,10 +78,11 @@ 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(); for (QaQueContent question : qaContent.getQaQueContents()) { 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.53.2.26 -r1.53.2.27 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 26 Jul 2016 02:44:49 -0000 1.53.2.26 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 11 Oct 2016 05:20:42 -0000 1.53.2.27 @@ -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(); @@ -212,7 +213,7 @@ // notify teachers on response submit if (errors.isEmpty() && qaContent.isNotifyTeachersOnResponseSubmit()) { - QaLearningAction.qaService.notifyTeachersOnResponseSubmit(new Long(toolSessionID)); + qaService.notifyTeachersOnResponseSubmit(new Long(toolSessionID)); } return (mapping.findForward(forwardName)); @@ -223,7 +224,7 @@ Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - QaSession session = QaLearningAction.qaService.getSessionById(toolSessionId); + QaSession session = qaService.getSessionById(toolSessionId); QaQueUsr leader = session.getGroupLeader(); boolean isLeaderResponseFinalized = leader.isResponseFinalized(); @@ -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()); @@ -360,7 +361,7 @@ String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); String userID = request.getParameter("userID"); - QaQueUsr user = QaLearningAction.qaService.getUserByIdAndSession(new Long(userID), new Long(toolSessionID)); + QaQueUsr user = qaService.getUserByIdAndSession(new Long(userID), new Long(toolSessionID)); QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue()); QaContent qaContent = qaSession.getQaContent(); @@ -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; @@ -452,13 +450,13 @@ qaLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter("userID"); - QaQueUsr user = QaLearningAction.qaService.getUserByIdAndSession(new Long(userID), new Long(toolSessionID)); + QaQueUsr user = qaService.getUserByIdAndSession(new Long(userID), new Long(toolSessionID)); QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue()); 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); @@ -627,8 +623,8 @@ String totalQuestionCount = qaLearningForm.getTotalQuestionCount(); - int remainingQuestionCount = (new Long(totalQuestionCount).intValue() - - new Integer(currentQuestionIndex).intValue()) + 1; + int remainingQuestionCount = new Long(totalQuestionCount).intValue() + - new Integer(currentQuestionIndex).intValue() + 1; String userFeedback = ""; if (remainingQuestionCount != 0) { userFeedback = "Remaining question count: " + remainingQuestionCount; @@ -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)); 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.86.2.11 -r1.86.2.12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 11 May 2016 07:36:00 -0000 1.86.2.11 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 11 Oct 2016 05:20:42 -0000 1.86.2.12 @@ -184,7 +184,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.68.2.5 -r1.68.2.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 11 May 2016 07:36:00 -0000 1.68.2.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 11 Oct 2016 05:20:42 -0000 1.68.2.6 @@ -138,7 +138,11 @@ boolean isGroupedActivity = qaService.isGroupedActivity(qaContent.getQaContentId()); request.setAttribute("isGroupedActivity", isGroupedActivity); - //rating stuff + //ratings stuff + boolean isRatingsEnabled = qaService.isRatingsEnabled(qaContent); + request.setAttribute("isRatingsEnabled", isRatingsEnabled); + + //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.53.2.18 -r1.53.2.19 --- lams_tool_laqa/web/learning/LearnerRep.jsp 4 Sep 2016 16:47:28 -0000 1.53.2.18 +++ lams_tool_laqa/web/learning/LearnerRep.jsp 11 Oct 2016 05:20:42 -0000 1.53.2.19 @@ -121,7 +121,7 @@ var usesRatings = false; var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -273,7 +273,7 @@ - + @@ -337,7 +337,7 @@
- +
@@ -356,7 +356,7 @@
<%--Rating area---------------------------------------%> - +

@@ -409,7 +409,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.32.2.17 -r1.32.2.18 --- lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp 4 Sep 2016 16:47:28 -0000 1.32.2.17 +++ lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp 11 Oct 2016 05:20:42 -0000 1.32.2.18 @@ -115,7 +115,7 @@ var hasStartedRating = false; - if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + if (${generalLearnerFlowDTO.allowRateAnswers}) { rows += ''; if (userData["visible"] == 'true') { @@ -264,7 +264,7 @@ - + @@ -325,7 +325,7 @@
- +
@@ -345,7 +345,7 @@ <%--Rating area---------------------------------------%> - +

@@ -410,7 +410,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.39.2.17 -r1.39.2.18 --- lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 4 Sep 2016 16:47:12 -0000 1.39.2.17 +++ lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 11 Oct 2016 05:20:42 -0000 1.39.2.18 @@ -163,7 +163,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.46.2.5 -r1.46.2.6 --- lams_tool_laqa/web/monitoring/SummaryContent.jsp 26 Jul 2016 02:44:49 -0000 1.46.2.5 +++ lams_tool_laqa/web/monitoring/SummaryContent.jsp 11 Oct 2016 05:20:42 -0000 1.46.2.6 @@ -58,7 +58,7 @@ - +