Index: lams_monitoring/web/css/tblmonitor.scss =================================================================== diff -u -r7913826df20868a8bf035076a14ac89d5e615b46 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_monitoring/web/css/tblmonitor.scss (.../tblmonitor.scss) (revision 7913826df20868a8bf035076a14ac89d5e615b46) +++ lams_monitoring/web/css/tblmonitor.scss (.../tblmonitor.scss) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -396,4 +396,8 @@ .burning-question-description div, .burning-question-count { display: inline; +} + +.disclose-button-group { + margin-top: -2px; } \ No newline at end of file Index: lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml =================================================================== diff -u -r373dcc4ea6d1a07c60268ceccd9d1e69d9c35f9c -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml (.../AssessmentQuestion.hbm.xml) (revision 373dcc4ea6d1a07c60268ceccd9d1e69d9c35f9c) +++ lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml (.../AssessmentQuestion.hbm.xml) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -241,12 +241,22 @@ insert="true" column="hedging_justification_enabled" /> + + - + Index: lams_tool_assessment/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -re9d9d7d835d7d0d7fd5176c2ed6d8c2041ca330c -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e9d9d7d835d7d0d7fd5176c2ed6d8c2041ca330c) +++ lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -333,5 +333,6 @@ label.authoring.advance.disclose.answers =Disclose learner's and other groups' answers in monitor label.learning.summary.team.answers = Your team's answers label.learning.summary.other.team.answers =Other teams' answers - +label.disclose.correct.answers =Disclose correct answers +label.disclose.groups.answers =Disclose groups' answers #======= End labels: Exported 324 labels for en AU ===== Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/assessmentApplicationContext.xml =================================================================== diff -u -rfcc5eca8a605afdc9e927366827553a7862000cd -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/assessmentApplicationContext.xml (.../assessmentApplicationContext.xml) (revision fcc5eca8a605afdc9e927366827553a7862000cd) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/assessmentApplicationContext.xml (.../assessmentApplicationContext.xml) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -131,6 +131,7 @@ PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception + PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception PROPAGATION_REQUIRED,-java.lang.Exception Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20180330.sql =================================================================== diff -u -r8d12e38358cf4253f46f914de5fb7630482c9358 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20180330.sql (.../patch20180330.sql) (revision 8d12e38358cf4253f46f914de5fb7630482c9358) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dbupdates/patch20180330.sql (.../patch20180330.sql) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -3,10 +3,13 @@ SET FOREIGN_KEY_CHECKS=0; ----------------------Put all sql statements below here------------------------- --- LDEV-4540 Allow teachers to release other groups' answers in TBL monitor +-- LDEV-4540 Allow teachers to release correct and other groups' answers in monitor ALTER TABLE tl_laasse10_assessment ADD COLUMN allow_disclose_answers TINYINT(1) DEFAULT 0 AFTER allow_overall_feedback; +ALTER TABLE tl_laasse10_assessment_question ADD COLUMN correct_answers_disclosed TINYINT(1) DEFAULT 0, + ADD COLUMN groups_answers_disclosed TINYINT(1) DEFAULT 0; + ----------------------Put all sql statements above here------------------------- -- If there were no errors, commit and restore autocommit to on Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dto/QuestionDTO.java =================================================================== diff -u -r373dcc4ea6d1a07c60268ceccd9d1e69d9c35f9c -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dto/QuestionDTO.java (.../QuestionDTO.java) (revision 373dcc4ea6d1a07c60268ceccd9d1e69d9c35f9c) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/dto/QuestionDTO.java (.../QuestionDTO.java) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -54,11 +54,15 @@ private Set units; private int maxWordsLimit; - + private int minWordsLimit; private boolean hedgingJustificationEnabled; + private boolean correctAnswersDisclosed; + + private boolean groupsAnswersDisclosed; + // ============= variable properties ============= private String answerString; @@ -84,7 +88,7 @@ private Set matchingPairOptions; private List questionResults; - + private int confidenceLevel; public QuestionDTO(AssessmentQuestion question) { @@ -111,263 +115,308 @@ this.maxWordsLimit = question.getMaxWordsLimit(); this.minWordsLimit = question.getMinWordsLimit(); this.hedgingJustificationEnabled = question.isHedgingJustificationEnabled(); + this.correctAnswersDisclosed = question.isCorrectAnswersDisclosed(); + this.groupsAnswersDisclosed = question.isGroupsAnswersDisclosed(); optionDtos = new TreeSet(new SequencableComparator()); - for (AssessmentQuestionOption option: question.getOptions()) { - optionDtos.add(new OptionDTO(option)); + for (AssessmentQuestionOption option : question.getOptions()) { + optionDtos.add(new OptionDTO(option)); } } public Long getUid() { return uid; } + public void setUid(Long userID) { this.uid = userID; } public short getType() { return type; } + public void setType(short type) { this.type = type; } - + public String getTitle() { return title; } + public void setTitle(String title) { this.title = title; } public String getQuestion() { return question; } + public void setQuestion(String question) { this.question = question; } public int getSequenceId() { return sequenceId; } + public void setSequenceId(int sequenceId) { this.sequenceId = sequenceId; } public int getDefaultGrade() { return defaultGrade; } + public void setDefaultGrade(int defaultGrade) { this.defaultGrade = defaultGrade; } public float getPenaltyFactor() { return penaltyFactor; } + public void setPenaltyFactor(float penaltyFactor) { this.penaltyFactor = penaltyFactor; } public boolean isAnswerRequired() { return answerRequired; } + public void setAnswerRequired(boolean answerRequired) { this.answerRequired = answerRequired; } public String getGeneralFeedback() { return generalFeedback; } + public void setGeneralFeedback(String generalFeedback) { this.generalFeedback = generalFeedback; } public String getFeedback() { return feedback; } + public void setFeedback(String feedback) { this.feedback = feedback; } public boolean isMultipleAnswersAllowed() { return multipleAnswersAllowed; } + public void setMultipleAnswersAllowed(boolean multipleAnswersAllowed) { this.multipleAnswersAllowed = multipleAnswersAllowed; } public boolean isIncorrectAnswerNullifiesMark() { return incorrectAnswerNullifiesMark; } + public void setIncorrectAnswerNullifiesMark(boolean incorrectAnswerNullifiesMark) { this.incorrectAnswerNullifiesMark = incorrectAnswerNullifiesMark; } public String getFeedbackOnCorrect() { return feedbackOnCorrect; } + public void setFeedbackOnCorrect(String feedbackOnCorrect) { this.feedbackOnCorrect = feedbackOnCorrect; } public String getFeedbackOnPartiallyCorrect() { return feedbackOnPartiallyCorrect; } + public void setFeedbackOnPartiallyCorrect(String feedbackOnPartiallyCorrect) { this.feedbackOnPartiallyCorrect = feedbackOnPartiallyCorrect; } public String getFeedbackOnIncorrect() { return feedbackOnIncorrect; } + public void setFeedbackOnIncorrect(String feedbackOnIncorrect) { this.feedbackOnIncorrect = feedbackOnIncorrect; } public boolean isShuffle() { return shuffle; } + public void setShuffle(boolean shuffle) { this.shuffle = shuffle; } public boolean isCaseSensitive() { return caseSensitive; } + public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } public boolean getCorrectAnswer() { return correctAnswer; } + public void setCorrectAnswer(boolean correctAnswer) { this.correctAnswer = correctAnswer; } public boolean isAllowRichEditor() { return allowRichEditor; } + public void setAllowRichEditor(boolean allowRichEditor) { this.allowRichEditor = allowRichEditor; } public Set getUnits() { return units; } + public void setUnits(Set units) { this.units = units; } public int getMaxWordsLimit() { return maxWordsLimit; } + public void setMaxWordsLimit(int maxWordsLimit) { this.maxWordsLimit = maxWordsLimit; } public int getMinWordsLimit() { return minWordsLimit; } + public void setMinWordsLimit(int minWordsLimit) { this.minWordsLimit = minWordsLimit; } public boolean isHedgingJustificationEnabled() { return hedgingJustificationEnabled; } + public void setHedgingJustificationEnabled(boolean hedgingJustificationEnabled) { this.hedgingJustificationEnabled = hedgingJustificationEnabled; } - + + public boolean isCorrectAnswersDisclosed() { + return correctAnswersDisclosed; + } + + public boolean isGroupsAnswersDisclosed() { + return groupsAnswersDisclosed; + } // ============= variable properties ============= - + public String getAnswerString() { return answerString; } + public void setAnswerString(String answerString) { this.answerString = answerString; } public float getAnswerFloat() { return answerFloat; } + public void setAnswerFloat(float answerFloat) { this.answerFloat = answerFloat; } public boolean getAnswerBoolean() { return answerBoolean; } + public void setAnswerBoolean(boolean answerBoolean) { this.answerBoolean = answerBoolean; } - + public void setQuestionFeedback(String questionFeedback) { this.questionFeedback = questionFeedback; } + public String getQuestionFeedback() { return questionFeedback; } public int getGrade() { return grade; } + public void setGrade(int grade) { this.grade = grade; } public Float getMark() { return mark; } + public void setMark(Float mark) { this.mark = mark; } public Float getPenalty() { return penalty; } + public void setPenalty(Float penalty) { this.penalty = penalty; } public Set getMatchingPairOptions() { return matchingPairOptions; } + public void setMatchingPairOptions(Set matchingPairOptions) { this.matchingPairOptions = matchingPairOptions; } public List getQuestionResults() { return questionResults; } + public void setQuestionResults(List questionResults2) { this.questionResults = questionResults2; } - + public int getConfidenceLevel() { return confidenceLevel; } + public void setConfidenceLevel(int confidenceLevel) { this.confidenceLevel = confidenceLevel; } public boolean isResponseSubmitted() { return responseSubmitted; } + public void setResponseSubmitted(boolean responseSubmitted) { this.responseSubmitted = responseSubmitted; } public float getAnswerTotalGrade() { return answerTotalGrade; } + public void setAnswerTotalGrade(float answerTotalGrade) { this.answerTotalGrade = answerTotalGrade; } - + public Set getOptionDtos() { return optionDtos; } + public void setOptionDtos(Set optionDtos) { this.optionDtos = optionDtos; } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java =================================================================== diff -u -rf899620dd37f54eb375d29a5b15a7793c5dc3bb4 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java (.../AssessmentQuestion.java) (revision f899620dd37f54eb375d29a5b15a7793c5dc3bb4) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java (.../AssessmentQuestion.java) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -40,6 +40,7 @@ * @author Andrey Balan */ public class AssessmentQuestion implements Cloneable, Sequencable, Comparable { + private static final Logger log = Logger.getLogger(AssessmentQuestion.class); private Long uid; @@ -49,7 +50,7 @@ private String title; private String question; - + /** * It stores sha1(question) value that allows us to search for the AssessmentQuestions with the same question */ @@ -100,8 +101,12 @@ // only for hedging mark type of question private boolean hedgingJustificationEnabled; + private boolean correctAnswersDisclosed; + + private boolean groupsAnswersDisclosed; + // *************** NON Persist Fields used in monitoring ******************** - + private String titleEscaped; public AssessmentQuestion() { @@ -181,7 +186,7 @@ public int hashCode() { return new HashCodeBuilder().append(getUid()).append(getSequenceId()).toHashCode(); } - + public QuestionDTO getQuestionDTO() { QuestionDTO questionDTO = new QuestionDTO(this); @@ -210,30 +215,34 @@ public short getType() { return type; } + public void setType(short type) { this.type = type; } public String getTitle() { return title; } + public void setTitle(String title) { this.title = title; } public String getQuestion() { return question; } + public void setQuestion(String question) { this.question = question; } - + /** * Returns sha1(question) value that allows us to search for the AssessmentQuestions with the same question */ public String getQuestionHash() { return questionHash; } + public void setQuestionHash(String questionHash) { this.questionHash = questionHash; } @@ -277,90 +286,103 @@ public float getPenaltyFactor() { return penaltyFactor; } + public void setPenaltyFactor(float penaltyFactor) { this.penaltyFactor = penaltyFactor; } public boolean isAnswerRequired() { return answerRequired; } + public void setAnswerRequired(boolean answerRequired) { this.answerRequired = answerRequired; } public String getGeneralFeedback() { return generalFeedback; } + public void setGeneralFeedback(String generalFeedback) { this.generalFeedback = generalFeedback; } public String getFeedback() { return feedback; } + public void setFeedback(String feedback) { this.feedback = feedback; } public boolean isMultipleAnswersAllowed() { return multipleAnswersAllowed; } + public void setMultipleAnswersAllowed(boolean multipleAnswersAllowed) { this.multipleAnswersAllowed = multipleAnswersAllowed; } public boolean isIncorrectAnswerNullifiesMark() { return incorrectAnswerNullifiesMark; } + public void setIncorrectAnswerNullifiesMark(boolean incorrectAnswerNullifiesMark) { this.incorrectAnswerNullifiesMark = incorrectAnswerNullifiesMark; } public String getFeedbackOnCorrect() { return feedbackOnCorrect; } + public void setFeedbackOnCorrect(String feedbackOnCorrect) { this.feedbackOnCorrect = feedbackOnCorrect; } public String getFeedbackOnPartiallyCorrect() { return feedbackOnPartiallyCorrect; } + public void setFeedbackOnPartiallyCorrect(String feedbackOnPartiallyCorrect) { this.feedbackOnPartiallyCorrect = feedbackOnPartiallyCorrect; } public String getFeedbackOnIncorrect() { return feedbackOnIncorrect; } + public void setFeedbackOnIncorrect(String feedbackOnIncorrect) { this.feedbackOnIncorrect = feedbackOnIncorrect; } public boolean isShuffle() { return shuffle; } + public void setShuffle(boolean shuffle) { this.shuffle = shuffle; } public boolean isCaseSensitive() { return caseSensitive; } + public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } public boolean getCorrectAnswer() { return correctAnswer; } + public void setCorrectAnswer(boolean correctAnswer) { this.correctAnswer = correctAnswer; } public boolean isAllowRichEditor() { return allowRichEditor; } + public void setAllowRichEditor(boolean allowRichEditor) { this.allowRichEditor = allowRichEditor; } @@ -428,15 +450,33 @@ public boolean isHedgingJustificationEnabled() { return hedgingJustificationEnabled; } + public void setHedgingJustificationEnabled(boolean hedgingJustificationEnabled) { this.hedgingJustificationEnabled = hedgingJustificationEnabled; } - + + public boolean isCorrectAnswersDisclosed() { + return correctAnswersDisclosed; + } + + public void setCorrectAnswersDisclosed(boolean correctAnswersDisclosed) { + this.correctAnswersDisclosed = correctAnswersDisclosed; + } + + public boolean isGroupsAnswersDisclosed() { + return groupsAnswersDisclosed; + } + + public void setGroupsAnswersDisclosed(boolean groupsAnswersDisclosed) { + this.groupsAnswersDisclosed = groupsAnswersDisclosed; + } + // *************** NON Persist Fields used in monitoring ******************** public String getTitleEscaped() { return titleEscaped; } + public void setTitleEscaped(String titleEscaped) { this.titleEscaped = titleEscaped; } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== diff -u -rd39b9df30d44b56c287b8a1d4409407e60692dc4 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision d39b9df30d44b56c287b8a1d4409407e60692dc4) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -428,6 +428,16 @@ } @Override + public void updateAssessmentQuestion(AssessmentQuestion question) { + //update question's hash in case question's title or description got changed + String newHash = question.getQuestion() == null ? null : HashUtil.sha1(question.getQuestion()); + question.setQuestionHash(newHash); + + //store object in DB + assessmentQuestionDao.update(question); + } + + @Override public void releaseFromCache(Object object) { assessmentQuestionDao.evict(object); } @@ -639,7 +649,7 @@ } } - //if teacher edited content in monitor (modified question) it led to removal if autosaved questionResult + //if teacher edited content in monitor (modified question) it led to removal if autosaved questionResult if (assessment.isContentModifiedInMonitor(assessmentResult.getStartDate()) && questionResult == null) { //update questionDto AssessmentQuestion modifiedQuestion = assessmentQuestionDao.getByUid(questionDto.getUid()); @@ -1362,13 +1372,16 @@ userResultRow[2] = new ExcelCell(grade, false); summaryTabLearnerList.add(userResultRow); - if (grade < minGrade || minGrade == -9999999) + if (grade < minGrade || minGrade == -9999999) { minGrade = grade; - if (grade > maxGrade) + } + if (grade > maxGrade) { maxGrade = grade; + } } - if (minGrade == -9999999) + if (minGrade == -9999999) { minGrade = 0; + } LinkedHashMap markSummary = getMarksSummaryForSession(userDtos, minGrade, maxGrade, 10); @@ -1402,7 +1415,7 @@ binSummaryRow[2] = new ExcelCell(getMessage("label.percentage"), true, ExcelCell.BORDER_STYLE_BOTTOM_THIN); summaryTab.add(binSummaryRow); - float totalNumEntriesAsFloat = (float) totalNumEntries; + float totalNumEntriesAsFloat = totalNumEntries; for (Map.Entry entry : markSummary.entrySet()) { binSummaryRow = new ExcelCell[3]; binSummaryRow[0] = new ExcelCell(entry.getKey(), false); @@ -2359,8 +2372,9 @@ LinkedHashMap summary = new LinkedHashMap(); TreeMap inProgress = new TreeMap(); - if (numBuckets == null) + if (numBuckets == null) { numBuckets = 10; + } int bucketSize = 1; int intMinGrade = (int) Math.floor(minGrade); @@ -2395,15 +2409,16 @@ for (Map.Entry entry : inProgress.entrySet()) { String key; - if (bucketSize == 1) + if (bucketSize == 1) { key = entry.getKey().toString(); - else { + } else { if (maxGrade >= entry.getKey() && maxGrade <= entry.getKey() + bucketSize - 1) { - if ((int) maxGrade == entry.getKey()) + if ((int) maxGrade == entry.getKey()) { key = NumberUtil.formatLocalisedNumber(maxGrade, (Locale) null, 2); - else + } else { key = new StringBuilder().append(entry.getKey()).append(" - ") .append(NumberUtil.formatLocalisedNumber(maxGrade, (Locale) null, 2)).toString(); + } } else { key = new StringBuilder().append(entry.getKey()).append(" - ") .append(entry.getKey() + bucketSize - .01).toString(); @@ -2727,7 +2742,7 @@ } Assessment assessment = getAssessmentBySessionId(toolSessionId); - //in case Assessment is leader aware return all leaders confidences, otherwise - confidences from the users from the same group as requestor + //in case Assessment is leader aware return all leaders confidences, otherwise - confidences from the users from the same group as requestor List assessmentResultsAndPortraits = assessment.isUseSelectLeaderToolOuput() ? assessmentResultDao.getLeadersLastFinishedAssessmentResults(assessment.getContentId()) : assessmentResultDao.getLastFinishedAssessmentResultsBySession(toolSessionId); @@ -2738,7 +2753,7 @@ : ((Number) assessmentResultsAndPortraitIter[1]).longValue(); Long userId = assessmentResult.getUser().getUserId(); - //fill in question's and user answer's hashes + //fill in question's and user answer's hashes for (AssessmentQuestionResult questionResult : assessmentResult.getQuestionResults()) { AssessmentQuestion question = questionResult.getAssessmentQuestion(); @@ -2905,16 +2920,19 @@ Date startDate = null; Date finishDate = null; for (AssessmentResult result : results) { - if (startDate == null || (result.getStartDate() != null && result.getStartDate().before(startDate))) + if (startDate == null || (result.getStartDate() != null && result.getStartDate().before(startDate))) { startDate = result.getStartDate(); - if (finishDate == null || (result.getFinishDate() != null && result.getFinishDate().after(finishDate))) + } + if (finishDate == null || (result.getFinishDate() != null && result.getFinishDate().after(finishDate))) { finishDate = result.getFinishDate(); + } } - if (learner.isSessionFinished()) + if (learner.isSessionFinished()) { return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_COMPLETED, startDate, finishDate); - else + } else { return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_ATTEMPTED, startDate, null); + } } // ****************** REST methods ************************* @@ -3101,4 +3119,9 @@ // public static final short QUESTION_TYPE_TRUE_FALSE = 5; // public static final short QUESTION_TYPE_ORDERING = 7; } + + @Override + public AssessmentQuestion getAssessmentQuestionByUid(Long questionUid) { + return assessmentQuestionDao.getByUid(questionUid); + } } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java =================================================================== diff -u -ra05411c3da91b4b357b1615cc5361ea25e3614da -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java (.../IAssessmentService.java) (revision a05411c3da91b4b357b1615cc5361ea25e3614da) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java (.../IAssessmentService.java) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -82,12 +82,12 @@ */ void copyAnswersFromLeader(AssessmentUser user, AssessmentUser leader) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException; - + List getConfidenceLevels(Long toolSessionId); /** * Stores date when user has started activity with time limit. - * + * * @param assessmentUid * @param userId */ @@ -96,7 +96,7 @@ /** * Calculates how many seconds left till the time limit will expire. If it's expired already - returns 1 in order to * show learning.jsp and autosubmit results. - * + * * @param assessment * @param user * @return @@ -122,7 +122,7 @@ String searchString); int getCountUsersBySession(Long sessionId, String searchString); - + int getCountUsersByContentId(Long contentId); List getPagedUsersBySessionAndQuestion(Long sessionId, Long questionUid, int page, int size, @@ -159,14 +159,14 @@ * @return */ AssessmentUser getUserCreatedAssessment(Long userID, Long contentId); - + /** * Get user by given userID and toolContentID. * * @param long1 * @return */ - AssessmentUser getUserByIdAndContent(Long userID, Long contentId); + AssessmentUser getUserByIdAndContent(Long userID, Long contentId); /** * Get user by sessionID and UserID @@ -185,6 +185,11 @@ void saveOrUpdateAssessment(Assessment Assessment); /** + * Update assessment question into database. + */ + void updateAssessmentQuestion(AssessmentQuestion question); + + /** * Delete resoruce question from database. * * @param uid @@ -208,7 +213,7 @@ * @return */ AssessmentSession getSessionBySessionId(Long sessionId); - + /** * Get all assessment toolSessions by toolContentId * @@ -314,7 +319,7 @@ * @return */ Integer getLastFinishedAssessmentResultTimeTaken(Long assessmentUid, Long userId); - + /** * Count how many last finished attempts selected specified option. */ @@ -372,7 +377,7 @@ /** * Set userFinished to false - * + * * @param toolSessionId * @param userId */ @@ -430,25 +435,28 @@ LinkedHashMap exportSummary(Assessment assessment, List sessionDtos, boolean showUserNames); - /** + /** * Gets the basic statistics for the grades for the Leaders when an Assessment is done using * Group Leaders. So the averages, etc are for the whole Assessment, not for a Group. + * * @param contentId * @return */ LeaderResultsDTO getLeaderResultsDTOForLeaders(Long contentId); - - /** + + /** * Prepares data for the marks summary graph on the statistics page + * * @param assessment * @param sessionDtos * @return */ List getMarksArray(Long sessionId); - /** - * Prepares data for the marks summary graph on the statistics page, using the grades for the Leaders + /** + * Prepares data for the marks summary graph on the statistics page, using the grades for the Leaders * when an Assessment is done using Group Leaders. So the grades are for the whole Assessment, not for a Group. + * * @param assessment * @param sessionDtos * @return @@ -461,7 +469,7 @@ /** * Get a message from the language files with the given key - * + * * @param key * @return */ @@ -474,10 +482,10 @@ * @return */ boolean isGroupedActivity(long toolContentID); - + /** * Audit log the teacher has started editing activity in monitor. - * + * * @param toolContentID */ void auditLogStartEditingActivityInMonitor(long toolContentID); @@ -521,6 +529,8 @@ List deletedReferences); void releaseFromCache(Object object); - + Long getPortraitId(Long userId); + + AssessmentQuestion getAssessmentQuestionByUid(Long questionUid); } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/TblMonitoringAction.java =================================================================== diff -u -ra05411c3da91b4b357b1615cc5361ea25e3614da -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/TblMonitoringAction.java (.../TblMonitoringAction.java) (revision a05411c3da91b4b357b1615cc5361ea25e3614da) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/TblMonitoringAction.java (.../TblMonitoringAction.java) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -42,13 +42,13 @@ public class TblMonitoringAction extends LamsDispatchAction { private static Logger logger = Logger.getLogger(TblMonitoringAction.class.getName()); - + private IAssessmentService assessmentService; - + /** - * Shows ira page in case of Assessment activity - */ - public ActionForward iraAssessment(ActionMapping mapping, ActionForm form, HttpServletRequest request, + * Shows ira page in case of Assessment activity + */ + public ActionForward iraAssessment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { initAssessmentService(); Long toolContentId = WebUtil.readLongParam(request, "toolContentID"); @@ -62,24 +62,24 @@ request.setAttribute("isIraAssessment", true); return mapping.findForward("assessment"); } - - /** - * Shows ira page in case of Assessment activity - */ - public ActionForward iraAssessmentStudentChoices(ActionMapping mapping, ActionForm form, HttpServletRequest request, + + /** + * Shows ira page in case of Assessment activity + */ + public ActionForward iraAssessmentStudentChoices(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { initAssessmentService(); Long toolContentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); Assessment assessment = assessmentService.getAssessmentByContentId(toolContentId); - + //prepare list of the questions, filtering out questions that aren't supposed to be answered Set questionList = new TreeSet(); //in case there is at least one random question - we need to show all questions in a drop down select if (assessment.hasRandomQuestion()) { questionList.addAll(assessment.getQuestions()); - //show only questions from question list otherwise + //show only questions from question list otherwise } else { for (QuestionReference reference : (Set) assessment.getQuestionReferences()) { questionList.add(reference.getQuestion()); @@ -91,7 +91,7 @@ for (AssessmentQuestion question : questionList) { if (AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE == question.getType()) { mcqQuestions.add(question); - + //calculate maxOptionsInQuestion if (question.getOptions().size() > maxOptionsInQuestion) { maxOptionsInQuestion = question.getOptions().size(); @@ -107,7 +107,7 @@ for (AssessmentQuestionOption option : question.getOptions()) { int optionAttemptCount = assessmentService.countAttemptsPerOption(option.getUid()); - float percentage = (float)(optionAttemptCount * 100) / totalNumberOfUsers; + float percentage = (float) (optionAttemptCount * 100) / totalNumberOfUsers; option.setPercentage(percentage); } } @@ -116,19 +116,19 @@ request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentId); return mapping.findForward("iraAssessmentStudentChoices"); } - - private List getAssessmentDtos(String[] toolContentIds, String[] activityTitles) { + + private List getAssessmentDtos(String[] toolContentIds, String[] activityTitles) { List assessmentDtos = new ArrayList(); int i = 0; for (String toolContentIdStr : toolContentIds) { String activityTitle = activityTitles[i++]; - + //skip empty contentIds if (toolContentIdStr.length() == 0) { continue; } Long toolContentId = Long.parseLong(toolContentIdStr); - + TblAssessmentDTO assessmentDto = new TblAssessmentDTO(); int attemptedLearnersNumber = assessmentService.getCountUsersByContentId(toolContentId); @@ -140,11 +140,11 @@ assessmentDto.setQuestions(prepareQuestionsList(assessment)); assessmentDtos.add(assessmentDto); } - + return assessmentDtos; - } - - private Set prepareQuestionsList(Assessment assessment) { + } + + private Set prepareQuestionsList(Assessment assessment) { // question list to display Set questions = new TreeSet(); boolean hasRandomQuestion = false; @@ -155,7 +155,7 @@ if (hasRandomQuestion) { questions.addAll(assessment.getQuestions()); - // show only questions from question list otherwise + // show only questions from question list otherwise } else { for (QuestionReference reference : (Set) assessment.getQuestionReferences()) { //sort questions the same way references are sorted (as per LKC request) @@ -165,7 +165,7 @@ } } return questions; - } + } /** * Shows aes page @@ -179,7 +179,7 @@ List assessmentDtos = getAssessmentDtos(toolContentIds, activityTitles); request.setAttribute("assessmentDtos", assessmentDtos); - + Long toolContentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID, true); request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentId); @@ -327,10 +327,10 @@ return null; } - + /** * Get ModalDialog for Teams tab. - * + * * @throws JSONException * @throws IOException */ @@ -339,14 +339,44 @@ initAssessmentService(); long toolContentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); Long userId = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID); - + AssessmentUser user = assessmentService.getUserByIdAndContent(userId, toolContentId); AssessmentResultDTO result = assessmentService.getUserMasterDetail(user.getSession().getSessionId(), userId); request.setAttribute(AssessmentConstants.ATTR_ASSESSMENT_RESULT, result); - + return mapping.findForward("teams"); } - + + /** + * Allows displaying correct answers to learners + */ + public ActionForward discloseCorrectAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + initAssessmentService(); + + Long questionUid = WebUtil.readLongParam(request, "questionUid"); + AssessmentQuestion question = assessmentService.getAssessmentQuestionByUid(questionUid); + question.setCorrectAnswersDisclosed(true); + assessmentService.updateAssessmentQuestion(question); + + return null; + } + + /** + * Allows displaying other groups' answers to learners + */ + public ActionForward discloseGroupsAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + initAssessmentService(); + + Long questionUid = WebUtil.readLongParam(request, "questionUid"); + AssessmentQuestion question = assessmentService.getAssessmentQuestionByUid(questionUid); + question.setGroupsAnswersDisclosed(true); + assessmentService.updateAssessmentQuestion(question); + + return null; + } + // ************************************************************************************* // Private method // ************************************************************************************* Index: lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp =================================================================== diff -u -r211f820402b4f7f12249f196401ef3ce57623c09 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp (.../multiplechoice.jsp) (revision 211f820402b4f7f12249f196401ef3ce57623c09) +++ lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp (.../multiplechoice.jsp) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -16,10 +16,12 @@ - + - + Index: lams_tool_assessment/web/pages/learning/results/tblsummary.jsp =================================================================== diff -u -r3e641a0b7feb452871362520f48517f77575cd51 -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/web/pages/learning/results/tblsummary.jsp (.../tblsummary.jsp) (revision 3e641a0b7feb452871362520f48517f77575cd51) +++ lams_tool_assessment/web/pages/learning/results/tblsummary.jsp (.../tblsummary.jsp) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -49,8 +49,8 @@ <%-- This option was chosen by the user --%> - <%-- Grade 1 means this is the correct answer, so hightlight it --%> - + <%-- Grade 1 means this is the correct answer, so hightlight it, if it has been disclosed --%> + @@ -68,54 +68,59 @@ - - - - - - - - <%-- Now groups other than this one --%> - - - - <%-- Sessions are named after groups --%> - - - - <%-- Get the needed piece of information from a complicated questionSummaries structure --%> - - - - - - - - <%-- This option was chosen by the user --%> - - <%-- Find the matching option to check if it is correct and get its text --%> - - - - - - + + + + + + + + + <%-- Now groups other than this one --%> + + + + <%-- Sessions are named after groups --%> + + + + + + + <%-- Get the needed piece of information from a complicated questionSummaries structure --%> + + + + + + <%-- This option was chosen by the user --%> + + <%-- Find the matching option to check if it is correct and get its text --%> + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + Index: lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp =================================================================== diff -u -ra05411c3da91b4b357b1615cc5361ea25e3614da -r37945afeca0f748fbb1f1608d8317bea73234a5e --- lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp (.../assessment.jsp) (revision a05411c3da91b4b357b1615cc5361ea25e3614da) +++ lams_tool_assessment/web/pages/tblmonitoring/assessment.jsp (.../assessment.jsp) (revision 37945afeca0f748fbb1f1608d8317bea73234a5e) @@ -24,6 +24,21 @@ //insert total learners number taken from the parent tblmonitor.jsp $("#total-learners-number").html(TOTAL_LESSON_LEARNERS_NUMBER); + + // disclose correct/group answers on click + $('.disclose-button-group .btn').not('[disabled]').one('click', function(){ + var button = $(this); + $.ajax({ + 'url' : 'tblmonitoring.do', + 'data' : { + 'method' : button.hasClass('disclose-correct-button') ? 'discloseCorrectAnswers' : 'discloseGroupsAnswers', + 'questionUid' : button.closest('.disclose-button-group').attr('questionUid') + } + }).done(function(){ + // disable the button after click + button.attr('disabled', true).html(' ' + button.text()); + }); + }); }); @@ -97,9 +112,28 @@
-

+
Q${i.index+1}) -

+
+ <%-- Allow disclosing correct answers only for multiple choice questions --%> + +
+ disabled="disabled">  + > + +
+
+
+ disabled="disabled">  + > + +
+
+