Index: lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml =================================================================== diff -u -r8620cb3f29c4710a0ddfd597fdc1b676d4b2b4b0 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml (.../AssessmentQuestion.hbm.xml) (revision 8620cb3f29c4710a0ddfd597fdc1b676d4b2b4b0) +++ lams_tool_assessment/conf/hibernate/mappings/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.hbm.xml (.../AssessmentQuestion.hbm.xml) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -171,24 +171,6 @@ column="allow_rich_editor" /> - - - - units; + + private int maxWordsLimit; + + private int minWordsLimit; + + private boolean hedgingJustificationEnabled; + + // ============= variable properties ============= + + private String answerString; + + private float answerFloat; + + private boolean answerBoolean; + + private String questionFeedback; + + private boolean responseSubmitted; + + private int grade; + + private float mark; + + private float penalty; + + private float answerTotalGrade; + + private Set optionDtos; + + private Set matchingPairOptions; + + private List questionResults; + + public QuestionDTO(AssessmentQuestion question) { + this.uid = question.getUid(); + this.type = question.getType(); + this.title = question.getTitle(); + this.question = question.getQuestion(); + this.sequenceId = question.getSequenceId(); + this.defaultGrade = question.getDefaultGrade(); + this.penaltyFactor = question.getPenaltyFactor(); + this.answerRequired = question.isAnswerRequired(); + this.generalFeedback = question.getGeneralFeedback(); + this.feedback = question.getFeedback(); + this.multipleAnswersAllowed = question.isMultipleAnswersAllowed(); + this.incorrectAnswerNullifiesMark = question.isIncorrectAnswerNullifiesMark(); + this.feedbackOnCorrect = question.getFeedbackOnCorrect(); + this.feedbackOnPartiallyCorrect = question.getFeedbackOnPartiallyCorrect(); + this.feedbackOnIncorrect = question.getFeedbackOnIncorrect(); + this.shuffle = question.isShuffle(); + this.caseSensitive = question.isCaseSensitive(); + this.correctAnswer = question.getCorrectAnswer(); + this.allowRichEditor = question.isAllowRichEditor(); + this.units = question.getUnits(); + this.maxWordsLimit = question.getMaxWordsLimit(); + this.minWordsLimit = question.getMinWordsLimit(); + this.hedgingJustificationEnabled = question.isHedgingJustificationEnabled(); + + optionDtos = new TreeSet(new SequencableComparator()); + 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; + } + + // ============= 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 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/Assessment.java =================================================================== diff -u -r2d0422cb41945e1e1b52ad67403354df34fae0aa -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java (.../Assessment.java) (revision 2d0422cb41945e1e1b52ad67403354df34fae0aa) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/Assessment.java (.../Assessment.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -127,16 +127,6 @@ // reset user info as well if (toContent.getCreatedBy() != null) { toContent.getCreatedBy().setAssessment(toContent); - Set questions = toContent.getQuestions(); - for (AssessmentQuestion question : questions) { - question.setCreateBy(toContent.getCreatedBy()); - } - Set questionReferences = toContent.getQuestionReferences(); - for (QuestionReference questionReference : questionReferences) { - if (questionReference.getQuestion() != null) { - questionReference.getQuestion().setCreateBy(toContent.getCreatedBy()); - } - } } return toContent; } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java =================================================================== diff -u -re10da332d88104fe61b1f646b8bcac22bbfd15f0 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java (.../AssessmentQuestion.java) (revision e10da332d88104fe61b1f646b8bcac22bbfd15f0) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestion.java (.../AssessmentQuestion.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -23,16 +23,15 @@ package org.lamsfoundation.lams.tool.assessment.model; -import java.util.Date; import java.util.Iterator; -import java.util.List; import java.util.Set; import java.util.TreeSet; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.assessment.dto.QuestionDTO; import org.lamsfoundation.lams.tool.assessment.util.SequencableComparator; /** @@ -84,10 +83,6 @@ private boolean allowRichEditor; - private Date createDate; - - private AssessmentUser createBy; - private Set options; private Set units; @@ -100,34 +95,10 @@ // only for hedging mark type of question private boolean hedgingJustificationEnabled; - // DTO fields: - private String answerString; - - private float answerFloat; - - private boolean answerBoolean; - - private String questionFeedback; - + // *************** NON Persist Fields used in monitoring ******************** + private String titleEscaped; - private boolean responseSubmitted; - - /** - * Grade acquired from QUestionReference in learner. - */ - private int grade; - - private float mark; - - private float penalty; - - private float answerTotalGrade; - - private Set matchingPairOptions; - - private List questionResults; - public AssessmentQuestion() { options = new TreeSet(new SequencableComparator()); units = new TreeSet(new SequencableComparator()); @@ -205,7 +176,13 @@ public int hashCode() { return new HashCodeBuilder().append(getUid()).append(getSequenceId()).toHashCode(); } + + public QuestionDTO getQuestionDTO() { + QuestionDTO questionDTO = new QuestionDTO(this); + return questionDTO; + } + // ********************************************************** // Get/Set methods // ********************************************************** @@ -225,38 +202,23 @@ this.uid = userID; } - /** - * - * @return - */ public short getType() { return type; } - public void setType(short type) { this.type = type; } - /** - * - * @return - */ public String getTitle() { return title; } - public void setTitle(String title) { this.title = title; } - /** - * - * @return - */ public String getQuestion() { return question; } - public void setQuestion(String question) { this.question = question; } @@ -265,8 +227,6 @@ * Returns image sequence number. * * @return image sequence number - * - * */ @Override public int getSequenceId() { @@ -286,10 +246,6 @@ /** * Default grade set in author. To be used only in author - * - * - * - * @return */ public int getDefaultGrade() { return defaultGrade; @@ -303,193 +259,98 @@ this.defaultGrade = defaultGrade; } - /** - * - * @return - */ public float getPenaltyFactor() { return penaltyFactor; } - public void setPenaltyFactor(float penaltyFactor) { this.penaltyFactor = penaltyFactor; } - /** - * - * @return - */ public boolean isAnswerRequired() { return answerRequired; } - public void setAnswerRequired(boolean answerRequired) { this.answerRequired = answerRequired; } - /** - * - * @return - */ public String getGeneralFeedback() { return generalFeedback; } - public void setGeneralFeedback(String generalFeedback) { this.generalFeedback = generalFeedback; } - /** - * - * @return - */ public String getFeedback() { return feedback; } - public void setFeedback(String feedback) { this.feedback = feedback; } - /** - * - * @return - */ public boolean isMultipleAnswersAllowed() { return multipleAnswersAllowed; } - public void setMultipleAnswersAllowed(boolean multipleAnswersAllowed) { this.multipleAnswersAllowed = multipleAnswersAllowed; } - /** - * - * @return - */ public boolean isIncorrectAnswerNullifiesMark() { return incorrectAnswerNullifiesMark; } - public void setIncorrectAnswerNullifiesMark(boolean incorrectAnswerNullifiesMark) { this.incorrectAnswerNullifiesMark = incorrectAnswerNullifiesMark; } - /** - * - * @return - */ public String getFeedbackOnCorrect() { return feedbackOnCorrect; } - public void setFeedbackOnCorrect(String feedbackOnCorrect) { this.feedbackOnCorrect = feedbackOnCorrect; } - /** - * - * @return - */ public String getFeedbackOnPartiallyCorrect() { return feedbackOnPartiallyCorrect; } - public void setFeedbackOnPartiallyCorrect(String feedbackOnPartiallyCorrect) { this.feedbackOnPartiallyCorrect = feedbackOnPartiallyCorrect; } - /** - * - * @return - */ public String getFeedbackOnIncorrect() { return feedbackOnIncorrect; } - public void setFeedbackOnIncorrect(String feedbackOnIncorrect) { this.feedbackOnIncorrect = feedbackOnIncorrect; } - /** - * - * @return - */ public boolean isShuffle() { return shuffle; } - public void setShuffle(boolean shuffle) { this.shuffle = shuffle; } - /** - * - * @return - */ public boolean isCaseSensitive() { return caseSensitive; } - public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } - /** - * - * @return - */ public boolean getCorrectAnswer() { return correctAnswer; } - public void setCorrectAnswer(boolean correctAnswer) { this.correctAnswer = correctAnswer; } - /** - * - * @return - */ public boolean isAllowRichEditor() { return allowRichEditor; } - public void setAllowRichEditor(boolean allowRichEditor) { this.allowRichEditor = allowRichEditor; } /** - * - * @return - */ - public Date getCreateDate() { - return createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - /** - * - * - * @return - */ - public AssessmentUser getCreateBy() { - return createBy; - } - - public void setCreateBy(AssessmentUser createBy) { - this.createBy = createBy; - } - - /** - * - * - * - * - * * @return a set of options to this AssessmentQuestion. */ public Set getOptions() { @@ -505,11 +366,6 @@ } /** - * - * - * - * - * * @return a set of units to this AssessmentQuestion. */ public Set getUnits() { @@ -526,10 +382,6 @@ /** * maxWordsLimit set in author. Used only for essay type of questions - * - * - * - * @return */ public int getMaxWordsLimit() { return maxWordsLimit; @@ -545,10 +397,6 @@ /** * minWordsLimit set in author. Used only for essay type of questions - * - * - * - * @return */ public int getMinWordsLimit() { return minWordsLimit; @@ -562,118 +410,19 @@ this.minWordsLimit = minWordsLimit; } - /** - * - * @return - */ public boolean isHedgingJustificationEnabled() { return hedgingJustificationEnabled; } - public void setHedgingJustificationEnabled(boolean hedgingJustificationEnabled) { this.hedgingJustificationEnabled = hedgingJustificationEnabled; } + + // *************** NON Persist Fields used in monitoring ******************** - 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 String getTitleEscaped() { return titleEscaped; } - public void setTitleEscaped(String titleEscaped) { this.titleEscaped = titleEscaped; } - - /** - * @return Grade acquired from QUestionReference in learner. - */ - public int getGrade() { - return grade; - } - - /** - * @param grade - * Grade acquired from QuestionReference in learner. - */ - 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 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; - } } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestionOption.java =================================================================== diff -u -re10da332d88104fe61b1f646b8bcac22bbfd15f0 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestionOption.java (.../AssessmentQuestionOption.java) (revision e10da332d88104fe61b1f646b8bcac22bbfd15f0) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/model/AssessmentQuestionOption.java (.../AssessmentQuestionOption.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -51,11 +51,8 @@ private String feedback; - // *************** NON Persist Fields ******************** - private int answerInt = -1; + // *************** DTO fields (used in monitoring) ******************** - private boolean answerBoolean; - private String questionEscaped; private String optionStringEscaped; @@ -197,22 +194,6 @@ this.feedback = feedback; } - public int getAnswerInt() { - return answerInt; - } - - public void setAnswerInt(int answerInt) { - this.answerInt = answerInt; - } - - public boolean getAnswerBoolean() { - return answerBoolean; - } - - public void setAnswerBoolean(boolean answerBoolean) { - this.answerBoolean = answerBoolean; - } - public String getQuestionEscaped() { return questionEscaped; } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== diff -u -rb9a48a62716b4def723a7935b94e30eca3f5c71a -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision b9a48a62716b4def723a7935b94e30eca3f5c71a) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -74,6 +74,8 @@ import org.lamsfoundation.lams.tool.assessment.dao.AssessmentSessionDAO; import org.lamsfoundation.lams.tool.assessment.dao.AssessmentUserDAO; import org.lamsfoundation.lams.tool.assessment.dto.AssessmentUserDTO; +import org.lamsfoundation.lams.tool.assessment.dto.OptionDTO; +import org.lamsfoundation.lams.tool.assessment.dto.QuestionDTO; import org.lamsfoundation.lams.tool.assessment.dto.QuestionSummary; import org.lamsfoundation.lams.tool.assessment.dto.ReflectDTO; import org.lamsfoundation.lams.tool.assessment.dto.SessionDTO; @@ -361,11 +363,6 @@ } @Override - public List getAuthoredQuestions(Long assessmentUid) { - return assessmentQuestionDao.getAuthoringQuestions(assessmentUid); - } - - @Override public void createUser(AssessmentUser assessmentUser) { // make sure the user was not created in the meantime AssessmentUser user = getUserByIDAndSession(assessmentUser.getUserId(), @@ -505,8 +502,9 @@ } @Override - public boolean storeUserAnswers(Assessment assessment, Long userId, List> pagedQuestions, Long singleMarkHedgingQuestionUid, - boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + public boolean storeUserAnswers(Assessment assessment, Long userId, List> pagedQuestions, + Long singleMarkHedgingQuestionUid, boolean isAutosave) + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { int maximumGrade = 0; float grade = 0; @@ -521,15 +519,14 @@ } // store all answers (in all pages) - for (Set questionsForOnePage : pagedQuestions) { - for (AssessmentQuestion question : questionsForOnePage) { + for (Set questionsForOnePage : pagedQuestions) { + for (QuestionDTO questionDto : questionsForOnePage) { // in case single MarkHedging question needs to be stored -- search for that question - if ((singleMarkHedgingQuestionUid != null) && !question.getUid().equals(singleMarkHedgingQuestionUid)) { + if ((singleMarkHedgingQuestionUid != null) && !questionDto.getUid().equals(singleMarkHedgingQuestionUid)) { continue; } - //TODO possibly move the next if-clause inside of storeUserAnswer() method // In case if assessment was modified in monitor after result has been started check question still exists in DB as // it could be deleted if (assessment.isContentModifiedInMonitor(result.getStartDate())) { @@ -539,13 +536,13 @@ boolean isQuestionExists = false; for (QuestionReference reference : references) { if (!reference.isRandomQuestion() - && reference.getQuestion().getUid().equals(question.getUid())) { + && reference.getQuestion().getUid().equals(questionDto.getUid())) { isQuestionExists = true; break; } if (reference.isRandomQuestion()) { for (AssessmentQuestion questionDb : questions) { - if (questionDb.getUid().equals(question.getUid())) { + if (questionDb.getUid().equals(questionDto.getUid())) { isQuestionExists = true; break; } @@ -557,10 +554,10 @@ } } - float userQeustionGrade = storeUserAnswer(result, question, isAutosave); + float userQeustionGrade = storeUserAnswer(result, questionDto, isAutosave); grade += userQeustionGrade; - maximumGrade += question.getGrade(); + maximumGrade += questionDto.getGrade(); } } @@ -587,20 +584,21 @@ * @throws InvocationTargetException * @throws IllegalAccessException */ - private float storeUserAnswer(AssessmentResult assessmentResult, AssessmentQuestion question, boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - + private float storeUserAnswer(AssessmentResult assessmentResult, QuestionDTO questionDto, boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { + Assessment assessment = assessmentResult.getAssessment(); + AssessmentQuestionResult questionResult = null; // get questionResult from DB instance of AssessmentResult for (AssessmentQuestionResult questionResultIter : assessmentResult.getQuestionResults()) { - if (question.getUid().equals(questionResultIter.getAssessmentQuestion().getUid())) { + if (questionDto.getUid().equals(questionResultIter.getAssessmentQuestion().getUid())) { questionResult = questionResultIter; } } if (assessmentResult.getFinishDate() == null && questionResult == null) { //it should get here only in case teacher edited content in monitor which led to removal of autosave questionResult - AssessmentQuestion modifiedQuestion = assessmentQuestionDao.getByUid(question.getUid()); - PropertyUtils.copyProperties(question, modifiedQuestion); + AssessmentQuestion modifiedQuestion = assessmentQuestionDao.getByUid(questionDto.getUid()); + PropertyUtils.copyProperties(questionDto, modifiedQuestion); return 0; // questionResult = createQuestionResultObject(question); @@ -609,67 +607,67 @@ } // store question answer values - questionResult.setAnswerBoolean(question.getAnswerBoolean()); - questionResult.setAnswerFloat(question.getAnswerFloat()); - questionResult.setAnswerString(question.getAnswerString()); + questionResult.setAnswerBoolean(questionDto.getAnswerBoolean()); + questionResult.setAnswerFloat(questionDto.getAnswerFloat()); + questionResult.setAnswerString(questionDto.getAnswerString()); int j = 0; - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { // find according optionAnswer AssessmentOptionAnswer optionAnswer = null; for (AssessmentOptionAnswer optionAnswerIter : questionResult.getOptionAnswers()) { - if (option.getUid().equals(optionAnswerIter.getOptionUid())) { + if (optionDto.getUid().equals(optionAnswerIter.getOptionUid())) { optionAnswer = optionAnswerIter; } } // store option answer values - optionAnswer.setAnswerBoolean(option.getAnswerBoolean()); - optionAnswer.setAnswerInt(option.getAnswerInt()); - if (question.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { + optionAnswer.setAnswerBoolean(optionDto.getAnswerBoolean()); + optionAnswer.setAnswerInt(optionDto.getAnswerInt()); + if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { optionAnswer.setAnswerInt(j++); } } float mark = 0; - float maxMark = question.getGrade(); - if (question.getType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { + float maxMark = questionDto.getGrade(); + if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { boolean isMarkNullified = false; float totalGrade = 0; - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getAnswerBoolean()) { - totalGrade += option.getGrade(); - mark += option.getGrade() * maxMark; + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getAnswerBoolean()) { + totalGrade += optionDto.getGrade(); + mark += optionDto.getGrade() * maxMark; // if option of "incorrect answer nullifies mark" is ON check if selected answer has a zero grade // and if so nullify question's mark - if (question.isIncorrectAnswerNullifiesMark() && (option.getGrade() == 0)) { + if (questionDto.isIncorrectAnswerNullifiesMark() && (optionDto.getGrade() == 0)) { isMarkNullified = true; } } } // set answerTotalGrade to let jsp know whether the question was answered correctly/partly/incorrectly even if mark=0 - question.setAnswerTotalGrade(totalGrade); + questionDto.setAnswerTotalGrade(totalGrade); if (isMarkNullified) { mark = 0; } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { - float maxMarkForCorrectAnswer = maxMark / question.getOptions().size(); - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getAnswerInt() == option.getUid()) { + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { + float maxMarkForCorrectAnswer = maxMark / questionDto.getOptionDtos().size(); + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getAnswerInt() == optionDto.getUid()) { mark += maxMarkForCorrectAnswer; } } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER) { - for (AssessmentQuestionOption option : question.getOptions()) { + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { //prepare regex which takes into account only * special character String regexWithOnlyAsteriskSymbolActive = "\\Q"; - String optionString = option.getOptionString().trim(); + String optionString = optionDto.getOptionString().trim(); for (int i = 0; i < optionString.length(); i++) { //everything in between \\Q and \\E are taken literally no matter which characters it contains if (optionString.charAt(i) == '*') { @@ -682,36 +680,36 @@ //check whether answer matches regex Pattern pattern; - if (question.isCaseSensitive()) { + if (questionDto.isCaseSensitive()) { pattern = Pattern.compile(regexWithOnlyAsteriskSymbolActive); } else { pattern = Pattern.compile(regexWithOnlyAsteriskSymbolActive, java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.UNICODE_CASE); } - boolean isAnswerMatchedCurrentOption = (question.getAnswerString() != null) - ? pattern.matcher(question.getAnswerString().trim()).matches() : false; + boolean isAnswerMatchedCurrentOption = (questionDto.getAnswerString() != null) + ? pattern.matcher(questionDto.getAnswerString().trim()).matches() : false; if (isAnswerMatchedCurrentOption) { - mark = option.getGrade() * maxMark; - questionResult.setSubmittedOptionUid(option.getUid()); + mark = optionDto.getGrade() * maxMark; + questionResult.setSubmittedOptionUid(optionDto.getUid()); break; } } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_NUMERICAL) { - String answerString = question.getAnswerString(); + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_NUMERICAL) { + String answerString = questionDto.getAnswerString(); if (answerString != null) { - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { boolean isAnswerMatchedCurrentOption = false; try { - float answerFloat = Float.valueOf(question.getAnswerString()); - isAnswerMatchedCurrentOption = ((answerFloat >= (option.getOptionFloat() - option.getAcceptedError())) - && (answerFloat <= (option.getOptionFloat() + option.getAcceptedError()))); + float answerFloat = Float.valueOf(questionDto.getAnswerString()); + isAnswerMatchedCurrentOption = ((answerFloat >= (optionDto.getOptionFloat() - optionDto.getAcceptedError())) + && (answerFloat <= (optionDto.getOptionFloat() + optionDto.getAcceptedError()))); } catch (Exception e) { } if (!isAnswerMatchedCurrentOption) { - for (AssessmentUnit unit : question.getUnits()) { + for (AssessmentUnit unit : questionDto.getUnits()) { String regex = ".*" + unit.getUnit() + "$"; Pattern pattern = Pattern.compile(regex, java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.UNICODE_CASE); @@ -721,9 +719,9 @@ try { float answerFloat = Float.valueOf(answerFloatStr); answerFloat = answerFloat / unit.getMultiplier(); - isAnswerMatchedCurrentOption = ((answerFloat >= (option.getOptionFloat() - - option.getAcceptedError())) - && (answerFloat <= (option.getOptionFloat() + option.getAcceptedError()))); + isAnswerMatchedCurrentOption = ((answerFloat >= (optionDto.getOptionFloat() + - optionDto.getAcceptedError())) + && (answerFloat <= (optionDto.getOptionFloat() + optionDto.getAcceptedError()))); if (isAnswerMatchedCurrentOption) { break; } @@ -733,36 +731,36 @@ } } if (isAnswerMatchedCurrentOption) { - mark = option.getGrade() * maxMark; - questionResult.setSubmittedOptionUid(option.getUid()); + mark = optionDto.getGrade() * maxMark; + questionResult.setSubmittedOptionUid(optionDto.getUid()); break; } } } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_TRUE_FALSE) { - if ((question.getAnswerBoolean() == question.getCorrectAnswer()) && (question.getAnswerString() != null)) { + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_TRUE_FALSE) { + if ((questionDto.getAnswerBoolean() == questionDto.getCorrectAnswer()) && (questionDto.getAnswerString() != null)) { mark = maxMark; } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { - float maxMarkForCorrectAnswer = maxMark / question.getOptions().size(); - TreeSet correctOptionSet = new TreeSet( - new SequencableComparator()); - correctOptionSet.addAll(question.getOptions()); - ArrayList correctOptionList = new ArrayList( - correctOptionSet); + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { + float maxMarkForCorrectAnswer = maxMark / questionDto.getOptionDtos().size(); + TreeSet correctOptionSet = new TreeSet(new SequencableComparator()); + correctOptionSet.addAll(questionDto.getOptionDtos()); + ArrayList correctOptionList = new ArrayList(correctOptionSet); int i = 0; - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getUid() == correctOptionList.get(i++).getUid()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getUid() == correctOptionList.get(i++).getUid()) { mark += maxMarkForCorrectAnswer; } } - } else if (question.getType() == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) { - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.isCorrect()) { - mark += option.getAnswerInt(); + } else if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.isCorrect()) { + //if hedgingMark is a default '-1', change it to '0' + int hedgingMark = optionDto.getAnswerInt() == -1 ? 0 : optionDto.getAnswerInt(); + mark += hedgingMark; break; } } @@ -787,10 +785,10 @@ Long assessmentUid = assessmentResult.getAssessment().getUid(); Long userId = assessmentResult.getUser().getUserId(); int numberWrongAnswers = assessmentQuestionResultDao.getNumberWrongAnswersDoneBefore(assessmentUid, - userId, question.getUid()); + userId, questionDto.getUid()); // calculate penalty itself - float penalty = question.getPenaltyFactor() * numberWrongAnswers; + float penalty = questionDto.getPenaltyFactor() * numberWrongAnswers; mark -= penalty; if (penalty > maxMark) { penalty = maxMark; @@ -806,7 +804,7 @@ questionResult.setMark(mark); questionResult.setMaxMark(maxMark); // for displaying purposes in case of submitSingleMarkHedgingQuestion() Ajax call - question.setMark(mark); + questionDto.setMark(mark); } return mark; @@ -991,10 +989,12 @@ AssessmentResult lastFinishedResult = assessmentResultDao.getLastFinishedAssessmentResultByUser(sessionId, userId); if (lastFinishedResult != null) { + //sorting SortedSet questionResults = new TreeSet( new AssessmentQuestionResultComparator()); questionResults.addAll(lastFinishedResult.getQuestionResults()); lastFinishedResult.setQuestionResults(questionResults); + //escaping AssessmentEscapeUtils.escapeQuotes(lastFinishedResult); } @@ -2097,11 +2097,6 @@ } toolContentObj.setCreatedBy(user); - // reset all assessmentquestion createBy user - Set questions = toolContentObj.getQuestions(); - for (AssessmentQuestion question : questions) { - question.setCreateBy(user); - } assessmentDao.saveObject(toolContentObj); } catch (ImportToolContentException e) { throw new ToolException(e); @@ -2438,13 +2433,11 @@ public void createRestToolContent(Integer userID, Long toolContentID, JSONObject toolContentJSON) throws JSONException { - Date updateDate = new Date(); - Assessment assessment = new Assessment(); assessment.setContentId(toolContentID); assessment.setTitle(toolContentJSON.getString(RestTags.TITLE)); assessment.setInstructions(toolContentJSON.getString(RestTags.INSTRUCTIONS)); - assessment.setCreated(updateDate); + assessment.setCreated(new Date()); assessment.setReflectOnActivity(JsonUtil.opt(toolContentJSON, RestTags.REFLECT_ON_ACTIVITY, Boolean.FALSE)); assessment.setReflectInstructions(JsonUtil.opt(toolContentJSON, RestTags.REFLECT_INSTRUCTIONS, (String) null)); @@ -2498,8 +2491,6 @@ question.setType(type); question.setTitle(questionJSONData.getString(RestTags.QUESTION_TITLE)); question.setQuestion(questionJSONData.getString(RestTags.QUESTION_TEXT)); - question.setCreateBy(assessmentUser); - question.setCreateDate(updateDate); question.setSequenceId(questionJSONData.getInt(RestTags.DISPLAY_ORDER)); question.setAllowRichEditor(JsonUtil.opt(questionJSONData, RestTags.ALLOW_RICH_TEXT_EDITOR, Boolean.FALSE)); Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java =================================================================== diff -u -rb9a48a62716b4def723a7935b94e30eca3f5c71a -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java (.../IAssessmentService.java) (revision b9a48a62716b4def723a7935b94e30eca3f5c71a) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/IAssessmentService.java (.../IAssessmentService.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -31,6 +31,7 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.assessment.dto.AssessmentUserDTO; +import org.lamsfoundation.lams.tool.assessment.dto.QuestionDTO; import org.lamsfoundation.lams.tool.assessment.dto.QuestionSummary; import org.lamsfoundation.lams.tool.assessment.dto.ReflectDTO; import org.lamsfoundation.lams.tool.assessment.dto.SessionDTO; @@ -42,7 +43,6 @@ import org.lamsfoundation.lams.tool.assessment.model.AssessmentSession; import org.lamsfoundation.lams.tool.assessment.model.AssessmentUser; import org.lamsfoundation.lams.tool.assessment.model.QuestionReference; -import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.ExcelCell; /** @@ -139,14 +139,6 @@ */ Assessment getDefaultContent(Long contentId) throws AssessmentApplicationException; - /** - * Get list of assessment questions by given assessmentUid. These assessment questions must be created by author. - * - * @param assessmentUid - * @return - */ - List getAuthoredQuestions(Long assessmentUid); - // ********** for user methods ************* /** * Create a new user in database. @@ -221,12 +213,13 @@ * indicates whether it's autosave request * * @return whether storing results is allowed, false otherwise - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws IllegalAccessException + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalAccessException */ - boolean storeUserAnswers(Assessment assessment, Long userId, List> pagedQuestions, - Long singleMarkHedgingQuestionUid, boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException; + boolean storeUserAnswers(Assessment assessment, Long userId, List> pagedQuestions, + Long singleMarkHedgingQuestionUid, boolean isAutosave) + throws IllegalAccessException, InvocationTargetException, NoSuchMethodException; /** * Return the latest result (it can be unfinished). Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AnswerIntComparator.java =================================================================== diff -u -r3399163940c61c9132223c758d274486e57ff9b7 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AnswerIntComparator.java (.../AnswerIntComparator.java) (revision 3399163940c61c9132223c758d274486e57ff9b7) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AnswerIntComparator.java (.../AnswerIntComparator.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -25,18 +25,18 @@ import java.util.Comparator; -import org.lamsfoundation.lams.tool.assessment.model.AssessmentQuestionOption; +import org.lamsfoundation.lams.tool.assessment.dto.OptionDTO; /** * AnswerIntComparator. * * @author Andrey Balan * */ -public class AnswerIntComparator implements Comparator { +public class AnswerIntComparator implements Comparator { @Override - public int compare(AssessmentQuestionOption o1, AssessmentQuestionOption o2) { + public int compare(OptionDTO o1, OptionDTO o2) { if ((o1 != null) && (o2 != null)) { return o1.getAnswerInt() - o2.getAnswerInt(); } else if (o1 != null) { Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentEscapeUtils.java =================================================================== diff -u -rf4a7078c373180ac9d6a5887366241bda9f3e719 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentEscapeUtils.java (.../AssessmentEscapeUtils.java) (revision f4a7078c373180ac9d6a5887366241bda9f3e719) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/util/AssessmentEscapeUtils.java (.../AssessmentEscapeUtils.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -44,43 +44,37 @@ * Escapes all characters that may brake JS code on assigning Java value to JS String variable (particularly escapes * all quotes in the following way \"). */ - public static void escapeQuotes(Object object) { - if (object instanceof UserSummary) { - UserSummary userSummary = (UserSummary) object; - for (UserSummaryItem userSummaryItem : userSummary.getUserSummaryItems()) { - for (AssessmentQuestionResult questionResult : userSummaryItem.getQuestionResults()) { - AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); - } + public static void escapeQuotes(UserSummary userSummary) { + for (UserSummaryItem userSummaryItem : userSummary.getUserSummaryItems()) { + for (AssessmentQuestionResult questionResult : userSummaryItem.getQuestionResults()) { + AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); } - } else if (object instanceof QuestionSummary) { - QuestionSummary questionSummary = (QuestionSummary) object; - - for (List sessionQuestionResults : questionSummary - .getQuestionResultsPerSession()) { - for (AssessmentQuestionResult questionResult : sessionQuestionResults) { - AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); - } - } - } else if (object instanceof List) { - List sessionDtos = (List) object; - - for (SessionDTO sessionDTO : sessionDtos) { - for (AssessmentResult result : sessionDTO.getAssessmentResults()) { - for (AssessmentQuestionResult questionResult : result.getQuestionResults()) { - AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); - } - } - } - } else if (object instanceof AssessmentResult) { - AssessmentResult assessmentResult = (AssessmentResult) object; - - for (AssessmentQuestionResult questionResult : assessmentResult.getQuestionResults()) { + } + } + + /** + * Escapes all characters that may brake JS code on assigning Java value to JS String variable (particularly escapes + * all quotes in the following way \"). + */ + public static void escapeQuotes(QuestionSummary questionSummary) { + for (List sessionQuestionResults : questionSummary.getQuestionResultsPerSession()) { + for (AssessmentQuestionResult questionResult : sessionQuestionResults) { AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); } } } + + /** + * Escapes all characters that may brake JS code on assigning Java value to JS String variable (particularly escapes + * all quotes in the following way \"). + */ + public static void escapeQuotes(AssessmentResult assessmentResult) { + for (AssessmentQuestionResult questionResult : assessmentResult.getQuestionResults()) { + AssessmentEscapeUtils.escapeQuotesInQuestionResult(questionResult); + } + } - public static void escapeQuotesInQuestionResult(AssessmentQuestionResult questionResult) { + private static void escapeQuotesInQuestionResult(AssessmentQuestionResult questionResult) { String answerString = questionResult.getAnswerString(); if (answerString != null) { String answerStringEscaped = StringEscapeUtils.escapeJavaScript(answerString); Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java =================================================================== diff -u -r81c8f8f5feb85c3614f8e104a70328b8c8b544d3 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 81c8f8f5feb85c3614f8e104a70328b8c8b544d3) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -241,39 +241,20 @@ // if assessment does not exist, try to use default content instead. if (assessment == null) { assessment = service.getDefaultContent(contentId); - if (assessment.getQuestions() != null) { - questions = new ArrayList(assessment.getQuestions()); - } else { - questions = null; - } - } else { - questions = service.getAuthoredQuestions(assessment.getUid()); } assessmentForm.setAssessment(assessment); } catch (Exception e) { AuthoringAction.log.error(e); throw new ServletException(e); } - - // init it to avoid null exception in following handling - if (questions == null) { - questions = new ArrayList(); + + if (assessment.getQuestions() != null) { + questions = new ArrayList(assessment.getQuestions()); } else { - AssessmentUser assessmentUser = null; - // handle system default question: createBy is null, now set it to current user - for (AssessmentQuestion question : questions) { - if (question.getCreateBy() == null) { - if (assessmentUser == null) { - // get back login user DTO - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - assessmentUser = new AssessmentUser(user, assessment); - } - question.setCreateBy(assessmentUser); - } - } + questions = new ArrayList(); } + // init assessment question list SortedSet questionList = getQuestionList(sessionMap); questionList.clear(); @@ -410,8 +391,6 @@ Set questions = new LinkedHashSet(); Set newQuestions = getQuestionList(sessionMap); for (AssessmentQuestion question : newQuestions) { - // This flushes user UID info to message if this user is a new user. - question.setCreateBy(assessmentUser); removeNewLineCharacters(question); questions.add(question); } @@ -596,7 +575,6 @@ Question[] questions = QuestionParser.parseQuestionChoiceForm(request); for (Question question : questions) { AssessmentQuestion assessmentQuestion = new AssessmentQuestion(); - assessmentQuestion.setCreateDate(new Timestamp(new Date().getTime())); int maxSeq = 1; if ((questionList != null) && (questionList.size() > 0)) { AssessmentQuestion last = questionList.last(); @@ -1309,7 +1287,6 @@ fullFilePath); if (questions != null) { for (AssessmentQuestion question : questions) { - question.setCreateDate(new Timestamp(new Date().getTime())); int maxSeq = 1; if ((oldQuestions != null) && (oldQuestions.size() > 0)) { AssessmentQuestion last = oldQuestions.last(); @@ -1352,7 +1329,6 @@ for (AssessmentQuestion question : getQuestionList(sessionMap)) { AssessmentQuestion clonedQuestion = (AssessmentQuestion) question.clone(); - clonedQuestion.setCreateBy(null); questionsToExport.add(clonedQuestion); } // exporting XML @@ -1811,7 +1787,7 @@ /* * BE CAREFUL: This method will copy nessary info from request form to an old or new AssessmentQuestion * instance. It - * gets all info EXCEPT AssessmentQuestion.createDate and AssessmentQuestion.createBy, which need be set when + * gets all info EXCEPT AssessmentQuestion.createDate, which need be set when * persisting * this assessment Question. */ @@ -1824,7 +1800,6 @@ if (questionIdx == -1) { // add question = new AssessmentQuestion(); - question.setCreateDate(new Timestamp(new Date().getTime())); int maxSeq = 1; if ((questionList != null) && (questionList.size() > 0)) { AssessmentQuestion last = questionList.last(); @@ -2040,7 +2015,8 @@ String sequenceId = paramMap.get(AssessmentConstants.ATTR_OPTION_SEQUENCE_ID_PREFIX + i); option.setSequenceId(NumberUtils.toInt(sequenceId)); option.setOptionString(optionString); - option.setAnswerInt(i); + //TODO check the following line is not required +// option.setAnswerInt(i); optionList.add(option); } else if (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) { String optionString = paramMap.get(AssessmentConstants.ATTR_OPTION_STRING_PREFIX + i); Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java =================================================================== diff -u -rb9a48a62716b4def723a7935b94e30eca3f5c71a -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision b9a48a62716b4def723a7935b94e30eca3f5c71a) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/action/LearningAction.java (.../LearningAction.java) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -60,6 +60,8 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.assessment.AssessmentConstants; +import org.lamsfoundation.lams.tool.assessment.dto.OptionDTO; +import org.lamsfoundation.lams.tool.assessment.dto.QuestionDTO; import org.lamsfoundation.lams.tool.assessment.model.Assessment; import org.lamsfoundation.lams.tool.assessment.model.AssessmentOptionAnswer; import org.lamsfoundation.lams.tool.assessment.model.AssessmentOverallFeedback; @@ -256,17 +258,11 @@ } } - int dbResultCount = service.getAssessmentResultCount(assessment.getUid(), user.getUserId()); - int attemptsAllowed = assessment.getAttemptsAllowed(); - boolean isResubmitAllowed = ((attemptsAllowed > dbResultCount) | (attemptsAllowed == 0)); - AssessmentResult lastResult = service.getLastAssessmentResult(assessment.getUid(), user.getUserId()); boolean hasEditRight = !assessment.isUseSelectLeaderToolOuput() || assessment.isUseSelectLeaderToolOuput() && isUserLeader; - boolean isLastResultFinished = (lastResult != null) && (lastResult.getFinishDate() != null); - //finishedLockForMonitor is a lock for displaying results page for teacher only if user see it, and displaying learner page if user see it accordingly - boolean finishedLockForMonitor = (mode != null) && mode.isTeacher() && isLastResultFinished; - boolean finishedLock = user.isSessionFinished() || finishedLockForMonitor || isLastResultFinished; + //showResults if either session or the last result is finished + boolean showResults = user.isSessionFinished() || (lastResult != null) && (lastResult.getFinishDate() != null); // get notebook entry String entryText = new String(); @@ -279,8 +275,7 @@ // basic information sessionMap.put(AssessmentConstants.ATTR_TITLE, assessment.getTitle()); sessionMap.put(AssessmentConstants.ATTR_INSTRUCTIONS, assessment.getInstructions()); - sessionMap.put(AssessmentConstants.ATTR_IS_RESUBMIT_ALLOWED, isResubmitAllowed); - sessionMap.put(AssessmentConstants.ATTR_FINISHED_LOCK, finishedLock); + sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, showResults); sessionMap.put(AssessmentConstants.ATTR_HAS_EDIT_RIGHT, hasEditRight); sessionMap.put(AssessmentConstants.ATTR_USER_FINISHED, user.isSessionFinished()); sessionMap.put(AttributeNames.ATTR_LEARNER_CONTENT_FOLDER, @@ -294,7 +289,7 @@ sessionMap.put(AssessmentConstants.ATTR_REFLECTION_ENTRY, entryText); //time limit - boolean isTimeLimitEnabled = hasEditRight && !finishedLock && assessment.getTimeLimit() != 0; + boolean isTimeLimitEnabled = hasEditRight && !showResults && assessment.getTimeLimit() != 0; long secondsLeft = isTimeLimitEnabled ? service.getSecondsLeft(assessment, user) : 0; request.setAttribute(AssessmentConstants.ATTR_SECONDS_LEFT, secondsLeft); boolean isTimeLimitNotLaunched = (lastResult == null) || (lastResult.getTimeLimitLaunchedDate() == null); @@ -328,77 +323,74 @@ } //sort questions - LinkedList questions = new LinkedList(); + LinkedList questionDtos = new LinkedList(); for (QuestionReference questionReference : questionReferences) { AssessmentQuestion question = questionToReferenceMap.get(questionReference.getUid()); - // initialize login name to avoid session close error in proxy object when displaying on a webpage - if (question.getCreateBy() != null) { - question.getCreateBy().getLoginName(); - } - question.setGrade(questionReference.getDefaultGrade()); + + QuestionDTO questionDto = question.getQuestionDTO(); + questionDto.setGrade(questionReference.getDefaultGrade()); - questions.add(question); + questionDtos.add(questionDto); } // shuffling if (assessment.isShuffled()) { - ArrayList shuffledList = new ArrayList(questions); + ArrayList shuffledList = new ArrayList(questionDtos); Collections.shuffle(shuffledList); - questions = new LinkedList(shuffledList); + questionDtos = new LinkedList(shuffledList); } - for (AssessmentQuestion question : questions) { - if (question.isShuffle() || (question.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING)) { - ArrayList shuffledList = new ArrayList( - question.getOptions()); + for (QuestionDTO questionDto : questionDtos) { + if (questionDto.isShuffle() || (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING)) { + ArrayList shuffledList = new ArrayList(questionDto.getOptionDtos()); Collections.shuffle(shuffledList); - question.setOptions(new LinkedHashSet(shuffledList)); + questionDto.setOptionDtos(new LinkedHashSet(shuffledList)); } - if (question.getType() == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { - ArrayList shuffledList = new ArrayList( - question.getOptions()); + if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { + ArrayList shuffledList = new ArrayList(questionDto.getOptionDtos()); Collections.shuffle(shuffledList); - question.setMatchingPairOptions(new LinkedHashSet(shuffledList)); + questionDto.setMatchingPairOptions(new LinkedHashSet(shuffledList)); } } //paging - List> pagedQuestions = new ArrayList>(); + List> pagedQuestionDtos = new ArrayList>(); int maxQuestionsPerPage = ((assessment.getQuestionsPerPage() != 0) && hasEditRight) - ? assessment.getQuestionsPerPage() : questions.size(); - LinkedHashSet questionsForOnePage = new LinkedHashSet(); - pagedQuestions.add(questionsForOnePage); + ? assessment.getQuestionsPerPage() : questionDtos.size(); + LinkedHashSet questionsForOnePage = new LinkedHashSet(); + pagedQuestionDtos.add(questionsForOnePage); int count = 0; - for (AssessmentQuestion question : questions) { - questionsForOnePage.add(question); + for (QuestionDTO questionDto : questionDtos) { + questionsForOnePage.add(questionDto); count++; - if ((questionsForOnePage.size() == maxQuestionsPerPage) && (count != questions.size())) { - questionsForOnePage = new LinkedHashSet(); - pagedQuestions.add(questionsForOnePage); + if ((questionsForOnePage.size() == maxQuestionsPerPage) && (count != questionDtos.size())) { + questionsForOnePage = new LinkedHashSet(); + pagedQuestionDtos.add(questionsForOnePage); } } - sessionMap.put(AssessmentConstants.ATTR_PAGED_QUESTIONS, pagedQuestions); + sessionMap.put(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS, pagedQuestionDtos); sessionMap.put(AssessmentConstants.ATTR_QUESTION_NUMBERING_OFFSET, 1); sessionMap.put(AssessmentConstants.ATTR_PAGE_NUMBER, 1); sessionMap.put(AssessmentConstants.ATTR_ASSESSMENT, assessment); - //set attempt started - if (!finishedLock && hasEditRight) { - service.setAttemptStarted(assessment, user, toolSessionId); - } - // loadupLastAttempt for display purpose loadupLastAttempt(sessionMap); + + if (showResults) { - //check if need to display results page - if ((dbResultCount > 0) && finishedLock) { // display results page - prepareResultsPageData(sessionMap); - } + return showResults(mapping, sessionMap); - return mapping.findForward(AssessmentConstants.SUCCESS); - } + } else { + // set attempt started + if (hasEditRight) { + service.setAttemptStarted(assessment, user, toolSessionId); + } + return mapping.findForward(AssessmentConstants.LEARNING); + } + } + /** * Checks Leader Progress */ @@ -437,8 +429,8 @@ Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT); AssessmentUser user = (AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER); - boolean finishedLock = (Boolean) sessionMap.get(AssessmentConstants.ATTR_FINISHED_LOCK); - if (!finishedLock) { + boolean showResults = (Boolean) sessionMap.get(AssessmentConstants.ATTR_SHOW_RESULTS); + if (!showResults) { //get user answers from request and store them into sessionMap storeUserAnswersIntoSessionMap(request); // store results from sessionMap into DB @@ -457,17 +449,21 @@ } int questionNumberingOffset = 0; - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); for (int i = 0; i < pageNumber - 1; i++) { - Set questionsForOnePage = pagedQuestions.get(i); + Set questionsForOnePage = pagedQuestionDtos.get(i); questionNumberingOffset += questionsForOnePage.size(); } sessionMap.put(AssessmentConstants.ATTR_QUESTION_NUMBERING_OFFSET, ++questionNumberingOffset); sessionMap.put(AssessmentConstants.ATTR_PAGE_NUMBER, pageNumber); request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(AssessmentConstants.SUCCESS); + if (showResults) { + return mapping.findForward(AssessmentConstants.SHOW_RESULTS); + } else { + return mapping.findForward(AssessmentConstants.LEARNING); + } } /** @@ -482,8 +478,8 @@ String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); Long toolSessionId = (Long) sessionMap.get(AssessmentConstants.ATTR_TOOL_SESSION_ID); Assessment assessment = service.getAssessmentBySessionId(toolSessionId); @@ -493,30 +489,29 @@ // store results from sessionMap into DB Long singleMarkHedgingQuestionUid = WebUtil.readLongParam(request, "singleMarkHedgingQuestionUid"); - boolean isResultsStored = service.storeUserAnswers(assessment, userId, pagedQuestions, 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) { //loadupLastAttempt(sessionMap); } //find according question in order to get its mark - AssessmentQuestion question = null; - for (Set questionsForOnePage : pagedQuestions) { - for (AssessmentQuestion questionIter : questionsForOnePage) { - if (questionIter.getUid().equals(singleMarkHedgingQuestionUid)) { - question = questionIter; - question.setResponseSubmitted(true); + QuestionDTO questionDto = null; + for (Set questionsForOnePage : pagedQuestionDtos) { + for (QuestionDTO questionDtoIter : questionsForOnePage) { + if (questionDtoIter.getUid().equals(singleMarkHedgingQuestionUid)) { + questionDto = questionDtoIter; + questionDto.setResponseSubmitted(true); } } } // populate info for displaying results page //prepareResultsPageData(sessionMap); - request.setAttribute("finishedLock", false); request.setAttribute("assessment", assessment); - request.setAttribute("question", question); + request.setAttribute("question", questionDto); long questionIndex = WebUtil.readLongParam(request, "questionIndex"); request.setAttribute("questionIndex", questionIndex); request.setAttribute("isEditingDisabled", true); @@ -537,6 +532,7 @@ String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); + request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); //get user answers from request and store them into sessionMap storeUserAnswersIntoSessionMap(request); @@ -563,24 +559,10 @@ loadupLastAttempt(sessionMap); } - // populate info for displaying results page - prepareResultsPageData(sessionMap); + sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, true); - Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT); - //calculate whether isResubmitAllowed - IAssessmentService service = getAssessmentService(); - HttpSession ss = SessionManager.getSession(); - UserDTO userDTO = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(userDTO.getUserID().longValue()); - int dbResultCount = service.getAssessmentResultCount(assessment.getUid(), userID); - int attemptsAllowed = assessment.getAttemptsAllowed(); - boolean isResubmitAllowed = ((attemptsAllowed > dbResultCount) | (attemptsAllowed == 0)); - sessionMap.put(AssessmentConstants.ATTR_IS_RESUBMIT_ALLOWED, isResubmitAllowed); - - sessionMap.put(AssessmentConstants.ATTR_FINISHED_LOCK, true); - request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); - - return mapping.findForward(AssessmentConstants.SUCCESS); + // populate info for displaying results page + return showResults(mapping, sessionMap); } /** @@ -607,19 +589,15 @@ // 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("startLearning")); + 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 } else { - -// List> pagedQuestions = (List>) sessionMap -// .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); -// service.setAttemptStarted(assessment, pagedQuestions, assessmentUser, toolSessionId); - sessionMap.put(AssessmentConstants.ATTR_FINISHED_LOCK, false); + sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, false); sessionMap.put(AssessmentConstants.ATTR_PAGE_NUMBER, 1); sessionMap.put(AssessmentConstants.ATTR_QUESTION_NUMBERING_OFFSET, 1); request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); @@ -630,7 +608,7 @@ sessionMap.put(AssessmentConstants.ATTR_IS_TIME_LIMIT_NOT_LAUNCHED, true); request.setAttribute(AssessmentConstants.ATTR_SECONDS_LEFT, assessment.getTimeLimit() * 60); - return mapping.findForward(AssessmentConstants.SUCCESS); + return mapping.findForward(AssessmentConstants.LEARNING); } } @@ -684,39 +662,39 @@ SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); int pageNumber = (Integer) sessionMap.get(AssessmentConstants.ATTR_PAGE_NUMBER); - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); - Set questionsForOnePage = pagedQuestions.get(pageNumber - 1); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); + Set questionsForOnePage = pagedQuestionDtos.get(pageNumber - 1); Long questionUid = new Long(request.getParameter(AssessmentConstants.PARAM_QUESTION_UID)); - AssessmentQuestion question = null; - for (AssessmentQuestion tempQuestion : questionsForOnePage) { - if (tempQuestion.getUid().equals(questionUid)) { - question = tempQuestion; + QuestionDTO questionDto = null; + for (QuestionDTO questionDtoIter : questionsForOnePage) { + if (questionDtoIter.getUid().equals(questionUid)) { + questionDto = questionDtoIter; break; } } - Set optionList = question.getOptions(); + Set optionDtoList = questionDto.getOptionDtos(); int optionIndex = NumberUtils.stringToInt(request.getParameter(AssessmentConstants.PARAM_OPTION_INDEX), -1); if (optionIndex != -1) { - List rList = new ArrayList(optionList); + List rList = new ArrayList(optionDtoList); // get current and the target item, and switch their sequnece - AssessmentQuestionOption option = rList.remove(optionIndex); + OptionDTO option = rList.remove(optionIndex); if (up) { rList.add(--optionIndex, option); } else { rList.add(++optionIndex, option); } // put back list - optionList = new LinkedHashSet(rList); - question.setOptions(optionList); + optionDtoList = new LinkedHashSet(rList); + questionDto.setOptionDtos(optionDtoList); } - request.setAttribute(AssessmentConstants.ATTR_QUESTION_FOR_ORDERING, question); + request.setAttribute(AssessmentConstants.ATTR_QUESTION_FOR_ORDERING, questionDto); request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID); return mapping.findForward(AssessmentConstants.SUCCESS); } @@ -836,89 +814,89 @@ SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); int pageNumber = (Integer) sessionMap.get(AssessmentConstants.ATTR_PAGE_NUMBER); - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); - Set questionsForOnePage = pagedQuestions.get(pageNumber - 1); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); + Set questionsForOnePage = pagedQuestionDtos.get(pageNumber - 1); for (int i = 0; i < questionsForOnePage.size(); i++) { - Long assessmentQuestionUid = WebUtil.readLongParam(request, AssessmentConstants.PARAM_QUESTION_UID + i); - AssessmentQuestion question = null; - for (AssessmentQuestion sessionQuestion : questionsForOnePage) { - if (sessionQuestion.getUid().equals(assessmentQuestionUid)) { - question = sessionQuestion; + Long questionUid = WebUtil.readLongParam(request, AssessmentConstants.PARAM_QUESTION_UID + i); + QuestionDTO questionDto = null; + for (QuestionDTO sessionQuestion : questionsForOnePage) { + if (sessionQuestion.getUid().equals(questionUid)) { + questionDto = sessionQuestion; break; } } // in case learner goes to the next page and refreshes it right after this. And thus it's not possible to know // previous page number in this case. but anyway no need to save answers - if (question == null) { + if (questionDto == null) { break; } - int questionType = question.getType(); + int questionType = questionDto.getType(); if (questionType == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { boolean answerBoolean = false; - if (question.isMultipleAnswersAllowed()) { + if (questionDto.isMultipleAnswersAllowed()) { String answerString = request.getParameter( - AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + option.getSequenceId()); + AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + optionDto.getSequenceId()); answerBoolean = !StringUtils.isBlank(answerString); } else { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); if (answerString != null) { int optionSequenceId = Integer.parseInt(answerString); - answerBoolean = (option.getSequenceId() == optionSequenceId); + answerBoolean = (optionDto.getSequenceId() == optionSequenceId); } } - option.setAnswerBoolean(answerBoolean); + optionDto.setAnswerBoolean(answerBoolean); } } else if (questionType == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { int answerInt = WebUtil.readIntParam(request, - AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + option.getSequenceId()); - option.setAnswerInt(answerInt); + AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + optionDto.getSequenceId()); + optionDto.setAnswerInt(answerInt); } } else if (questionType == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER) { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); - question.setAnswerString(answerString); + questionDto.setAnswerString(answerString); } else if (questionType == AssessmentConstants.QUESTION_TYPE_NUMERICAL) { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); - question.setAnswerString(answerString); + questionDto.setAnswerString(answerString); } else if (questionType == AssessmentConstants.QUESTION_TYPE_TRUE_FALSE) { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); if (answerString != null) { - question.setAnswerBoolean(Boolean.parseBoolean(answerString)); - question.setAnswerString("answered"); + questionDto.setAnswerBoolean(Boolean.parseBoolean(answerString)); + questionDto.setAnswerString("answered"); } } else if (questionType == AssessmentConstants.QUESTION_TYPE_ESSAY) { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); answerString = answerString.replaceAll("[\n\r\f]", ""); - question.setAnswerString(answerString); + questionDto.setAnswerString(answerString); } else if (questionType == AssessmentConstants.QUESTION_TYPE_ORDERING) { } else if (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) { //store hedging marks - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { Integer markHedging = WebUtil.readIntParam(request, - AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + option.getSequenceId(), true); + AssessmentConstants.ATTR_QUESTION_PREFIX + i + "_" + optionDto.getSequenceId(), true); if (markHedging != null) { - option.setAnswerInt(markHedging); + optionDto.setAnswerInt(markHedging); } } //store justification of hedging if enabled - if (question.isHedgingJustificationEnabled()) { + if (questionDto.isHedgingJustificationEnabled()) { String answerString = request.getParameter(AssessmentConstants.ATTR_QUESTION_PREFIX + i); answerString = answerString.replaceAll("[\n\r\f]", ""); - question.setAnswerString(answerString); + questionDto.setAnswerString(answerString); } } } @@ -933,42 +911,42 @@ */ private int validateAnswers(SessionMap sessionMap) { - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); //array of missing required questions boolean isAllQuestionsAnswered = true; boolean isAllQuestionsReachedMinWordsLimit = true; //iterate through all pages to find first that contains missing required questions int pageCount; - for (pageCount = 0; pageCount < pagedQuestions.size(); pageCount++) { - Set questionsForOnePage = pagedQuestions.get(pageCount); + for (pageCount = 0; pageCount < pagedQuestionDtos.size(); pageCount++) { + Set questionsForOnePage = pagedQuestionDtos.get(pageCount); - for (AssessmentQuestion question : questionsForOnePage) { - int questionType = question.getType(); + for (QuestionDTO questionDto : questionsForOnePage) { + int questionType = questionDto.getType(); //enforce all hedging marks question type to be answered as well - if (question.isAnswerRequired() || (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING)) { + if (questionDto.isAnswerRequired() || (questionType == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING)) { boolean isAnswered = false; if (questionType == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { - for (AssessmentQuestionOption option : question.getOptions()) { - isAnswered |= option.getAnswerBoolean(); + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + isAnswered |= optionDto.getAnswerBoolean(); } } else if (questionType == AssessmentConstants.QUESTION_TYPE_MATCHING_PAIRS) { - for (AssessmentQuestionOption option : question.getOptions()) { - isAnswered |= option.getAnswerInt() != 0; + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + isAnswered |= optionDto.getAnswerInt() != 0; } } else if ((questionType == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER) || (questionType == AssessmentConstants.QUESTION_TYPE_NUMERICAL) || (questionType == AssessmentConstants.QUESTION_TYPE_TRUE_FALSE) || (questionType == AssessmentConstants.QUESTION_TYPE_ESSAY)) { - isAnswered |= StringUtils.isNotBlank(question.getAnswerString()); + isAnswered |= StringUtils.isNotBlank(questionDto.getAnswerString()); } else if (questionType == AssessmentConstants.QUESTION_TYPE_ORDERING) { isAnswered = true; @@ -977,14 +955,14 @@ //verify sum of all hedging marks is equal to question's grade int sumMarkHedging = 0; - for (AssessmentQuestionOption option : question.getOptions()) { - sumMarkHedging += option.getAnswerInt(); + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + sumMarkHedging += optionDto.getAnswerInt(); } - isAnswered = sumMarkHedging == question.getGrade(); + isAnswered = sumMarkHedging == questionDto.getGrade(); //verify justification of hedging is provided if it was enabled - if (question.isHedgingJustificationEnabled()) { - isAnswered &= StringUtils.isNotBlank(question.getAnswerString()); + if (questionDto.isHedgingJustificationEnabled()) { + isAnswered &= StringUtils.isNotBlank(questionDto.getAnswerString()); } } @@ -996,13 +974,13 @@ } - if ((question.getType() == AssessmentConstants.QUESTION_TYPE_ESSAY) - && (question.getMinWordsLimit() > 0)) { + if ((questionDto.getType() == AssessmentConstants.QUESTION_TYPE_ESSAY) + && (questionDto.getMinWordsLimit() > 0)) { - String answer = new String(question.getAnswerString()); + String answer = new String(questionDto.getAnswerString()); boolean isMinWordsLimitReached = ValidationUtil.isMinWordsLimitReached(answer, - question.getMinWordsLimit(), question.isAllowRichEditor()); + questionDto.getMinWordsLimit(), questionDto.isAllowRichEditor()); // check min words limit is reached if (!isMinWordsLimitReached) { @@ -1025,87 +1003,99 @@ /** * Prepare data for displaying results page */ - private void prepareResultsPageData(SessionMap sessionMap) { - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + private ActionForward showResults(ActionMapping mapping, SessionMap sessionMap) { + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); IAssessmentService service = getAssessmentService(); - //release object from the cache (it's required when we have modified result object in the same request) - AssessmentResult result = service.getLastFinishedAssessmentResultNotFromChache(assessment.getUid(), userId); + + int dbResultCount = service.getAssessmentResultCount(assessment.getUid(), userId); + if (dbResultCount > 0) { - for (Set questionsForOnePage : pagedQuestions) { - for (AssessmentQuestion question : questionsForOnePage) { + // release object from the cache (it's required when we have modified result object in the same request) + AssessmentResult result = service.getLastFinishedAssessmentResultNotFromChache(assessment.getUid(), userId); - //find corresponding questionResult - for (AssessmentQuestionResult questionResult : result.getQuestionResults()) { - if (question.getUid().equals(questionResult.getAssessmentQuestion().getUid())) { + for (Set questionsForOnePage : pagedQuestionDtos) { + for (QuestionDTO questionDto : questionsForOnePage) { - //copy questionResult's info to the question - question.setMark(questionResult.getMark()); - question.setResponseSubmitted(questionResult.getFinishDate() != null); - question.setPenalty(questionResult.getPenalty()); - question.setQuestionFeedback(null); - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getUid().equals(questionResult.getSubmittedOptionUid())) { - question.setQuestionFeedback(option.getFeedback()); - break; - } - } - //required for showing right/wrong answers icons on results page correctly - if (question.getType() == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER - || question.getType() == AssessmentConstants.QUESTION_TYPE_NUMERICAL) { - boolean isAnsweredCorrectly = false; - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getUid().equals(questionResult.getSubmittedOptionUid())) { - isAnsweredCorrectly = option.getGrade() > 0; + // find corresponding questionResult + for (AssessmentQuestionResult questionResult : result.getQuestionResults()) { + if (questionDto.getUid().equals(questionResult.getAssessmentQuestion().getUid())) { + + // copy questionResult's info to the question + questionDto.setMark(questionResult.getMark()); + questionDto.setResponseSubmitted(questionResult.getFinishDate() != null); + questionDto.setPenalty(questionResult.getPenalty()); + questionDto.setQuestionFeedback(null); + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getUid().equals(questionResult.getSubmittedOptionUid())) { + questionDto.setQuestionFeedback(optionDto.getFeedback()); break; } } - question.setAnswerBoolean(isAnsweredCorrectly); - } + // required for showing right/wrong answers icons on results page correctly + if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER + || questionDto.getType() == AssessmentConstants.QUESTION_TYPE_NUMERICAL) { + boolean isAnsweredCorrectly = false; + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getUid().equals(questionResult.getSubmittedOptionUid())) { + isAnsweredCorrectly = optionDto.getGrade() > 0; + break; + } + } + questionDto.setAnswerBoolean(isAnsweredCorrectly); + } - //required for markandpenalty area and if it's on - on question's summary page - List questionResults = service.getAssessmentQuestionResultList(assessment.getUid(), - userId, question.getUid()); - question.setQuestionResults(questionResults); + // required for markandpenalty area and if it's on - on question's summary page + List questionResults = service + .getAssessmentQuestionResultList(assessment.getUid(), userId, questionDto.getUid()); + questionDto.setQuestionResults(questionResults); + } } } } - } - Date timeTaken = new Date(result.getFinishDate().getTime() - result.getStartDate().getTime()); - result.setTimeTaken(timeTaken); - if (assessment.isAllowOverallFeedbackAfterQuestion()) { - int percentageCorrectAnswers = (int) (result.getGrade() * 100 / result.getMaximumGrade()); - ArrayList overallFeedbacks = new ArrayList( - assessment.getOverallFeedbacks()); - int lastBorder = 0; - for (int i = overallFeedbacks.size() - 1; i >= 0; i--) { - AssessmentOverallFeedback overallFeedback = overallFeedbacks.get(i); - if ((percentageCorrectAnswers >= lastBorder) - && (percentageCorrectAnswers <= overallFeedback.getGradeBoundary())) { - result.setOverallFeedback(overallFeedback.getFeedback()); - break; + Date timeTaken = new Date(result.getFinishDate().getTime() - result.getStartDate().getTime()); + result.setTimeTaken(timeTaken); + if (assessment.isAllowOverallFeedbackAfterQuestion()) { + int percentageCorrectAnswers = (int) (result.getGrade() * 100 / result.getMaximumGrade()); + ArrayList overallFeedbacks = new ArrayList( + assessment.getOverallFeedbacks()); + int lastBorder = 0; + for (int i = overallFeedbacks.size() - 1; i >= 0; i--) { + AssessmentOverallFeedback overallFeedback = overallFeedbacks.get(i); + if ((percentageCorrectAnswers >= lastBorder) + && (percentageCorrectAnswers <= overallFeedback.getGradeBoundary())) { + result.setOverallFeedback(overallFeedback.getFeedback()); + break; + } + lastBorder = overallFeedback.getGradeBoundary(); } - lastBorder = overallFeedback.getGradeBoundary(); } - } - //calculate whether user has failed this attempt - int passingMark = assessment.getPassingMark(); - double gradeRoundedTo2DecimalPlaces = Math.round(result.getGrade() * 100.0) / 100.0; - boolean isUserFailed = ((passingMark != 0) && (passingMark > gradeRoundedTo2DecimalPlaces)); - sessionMap.put(AssessmentConstants.ATTR_IS_USER_FAILED, isUserFailed); + // calculate whether user has failed this attempt + int passingMark = assessment.getPassingMark(); + double gradeRoundedTo2DecimalPlaces = Math.round(result.getGrade() * 100.0) / 100.0; + boolean isUserFailed = ((passingMark != 0) && (passingMark > gradeRoundedTo2DecimalPlaces)); + sessionMap.put(AssessmentConstants.ATTR_IS_USER_FAILED, isUserFailed); - sessionMap.put(AssessmentConstants.ATTR_ASSESSMENT_RESULT, result); + sessionMap.put(AssessmentConstants.ATTR_ASSESSMENT_RESULT, result); + } + + //calculate whether isResubmitAllowed + int attemptsAllowed = assessment.getAttemptsAllowed(); + boolean isResubmitAllowed = ((attemptsAllowed > dbResultCount) | (attemptsAllowed == 0)); + sessionMap.put(AssessmentConstants.ATTR_IS_RESUBMIT_ALLOWED, isResubmitAllowed); + + return mapping.findForward(AssessmentConstants.SHOW_RESULTS); } private void loadupLastAttempt(SessionMap sessionMap) { IAssessmentService service = getAssessmentService(); - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + List> pagedQuestionDtos = (List>) sessionMap + .get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS); Long assessmentUid = ((Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT)).getUid(); Long userId = ((AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER)).getUserId(); //get the latest result (it can be unfinished one) @@ -1121,64 +1111,63 @@ lastFinishedResult = service.getLastFinishedAssessmentResult(assessmentUid, userId); } - for (Set questionsForOnePage : pagedQuestions) { - for (AssessmentQuestion question : questionsForOnePage) { + for (Set questionsForOnePage : pagedQuestionDtos) { + for (QuestionDTO questionDto : questionsForOnePage) { //load last finished results for hedging type of questions (in order to prevent retry) Set questionResults = lastResult.getQuestionResults(); - if ((question.getType() == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) + if ((questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MARK_HEDGING) && (lastResult.getFinishDate() == null) && (lastFinishedResult != null)) { questionResults = lastFinishedResult.getQuestionResults(); } for (AssessmentQuestionResult questionResult : questionResults) { - if (question.getUid().equals(questionResult.getAssessmentQuestion().getUid())) { - question.setAnswerBoolean(questionResult.getAnswerBoolean()); - question.setAnswerFloat(questionResult.getAnswerFloat()); - question.setAnswerString(questionResult.getAnswerString()); - question.setMark(questionResult.getMark()); - question.setResponseSubmitted(questionResult.getFinishDate() != null); - question.setPenalty(questionResult.getPenalty()); + if (questionDto.getUid().equals(questionResult.getAssessmentQuestion().getUid())) { + questionDto.setAnswerBoolean(questionResult.getAnswerBoolean()); + questionDto.setAnswerFloat(questionResult.getAnswerFloat()); + questionDto.setAnswerString(questionResult.getAnswerString()); + questionDto.setMark(questionResult.getMark()); + questionDto.setResponseSubmitted(questionResult.getFinishDate() != null); + questionDto.setPenalty(questionResult.getPenalty()); - for (AssessmentQuestionOption option : question.getOptions()) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { for (AssessmentOptionAnswer optionAnswer : questionResult.getOptionAnswers()) { - if (option.getUid().equals(optionAnswer.getOptionUid())) { - option.setAnswerBoolean(optionAnswer.getAnswerBoolean()); - option.setAnswerInt(optionAnswer.getAnswerInt()); + if (optionDto.getUid().equals(optionAnswer.getOptionUid())) { + optionDto.setAnswerBoolean(optionAnswer.getAnswerBoolean()); + optionDto.setAnswerInt(optionAnswer.getAnswerInt()); break; } } } //sort ordering type of question in order to show how learner has sorted them - if (question.getType() == AssessmentConstants.QUESTION_TYPE_ORDERING) { + 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 (AssessmentQuestionOption option : question.getOptions()) { - if (option.getAnswerInt() != 0) { + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getAnswerInt() != 0) { isOptionAnswersNeverSubmitted = false; } } if (!isOptionAnswersNeverSubmitted) { - TreeSet orderedSet = new TreeSet( - new AnswerIntComparator()); - orderedSet.addAll(question.getOptions()); - question.setOptions(orderedSet); + TreeSet orderedSet = new TreeSet(new AnswerIntComparator()); + orderedSet.addAll(questionDto.getOptionDtos()); + questionDto.setOptionDtos(orderedSet); } } // set answerTotalGrade to let jsp know whether the question was answered correctly/partly/incorrectly even if mark=0 - if (question.getType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { + if (questionDto.getType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE) { float totalGrade = 0; - for (AssessmentQuestionOption option : question.getOptions()) { - if (option.getAnswerBoolean()) { - totalGrade += option.getGrade(); + for (OptionDTO optionDto : questionDto.getOptionDtos()) { + if (optionDto.getAnswerBoolean()) { + totalGrade += optionDto.getGrade(); } } - question.setAnswerTotalGrade(totalGrade); + questionDto.setAnswerTotalGrade(totalGrade); } break; @@ -1196,15 +1185,15 @@ */ private boolean storeUserAnswersIntoDatabase(SessionMap sessionMap, boolean isAutosave) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - List> pagedQuestions = (List>) sessionMap - .get(AssessmentConstants.ATTR_PAGED_QUESTIONS); + 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, pagedQuestions, null, isAutosave); + boolean isResultsStored = service.storeUserAnswers(assessment, userId, pagedQuestionDtos, null, isAutosave); // notify teachers if ((mode != null) && !mode.isTeacher() && !isAutosave && isResultsStored Index: lams_tool_assessment/web/WEB-INF/struts-config.xml =================================================================== diff -u -r2d0422cb41945e1e1b52ad67403354df34fae0aa -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 2d0422cb41945e1e1b52ad67403354df34fae0aa) +++ lams_tool_assessment/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -218,7 +218,8 @@ - + + @@ -227,17 +228,19 @@ - + + - + + - + - - + + - - + Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -r75c878d64f17f9d53cee756dedfe499b77624514 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 75c878d64f17f9d53cee756dedfe499b77624514) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -17,14 +17,12 @@ - - + - @@ -65,7 +63,6 @@ } - @@ -191,7 +188,7 @@ //autosave feature - + var autosaveInterval = "30000"; // 30 seconds interval window.setInterval( @@ -238,23 +235,6 @@ $('.btn').prop('disabled',true); } - function finishSession(){ - if (!validateAnswers()) { - return; - } - disableButtons(); - document.location.href =''; - return false; - } - - function continueReflect(){ - if (!validateAnswers()) { - return; - } - disableButtons(); - document.location.href=''; - } - function nextPage(pageNumber){ if (!validateAnswers()) { return; @@ -294,13 +274,7 @@ $('#question-area-' + questionIndex).removeClass('bg-warning'); } }); - } - - function resubmit(){ - disableButtons(); - document.location.href =""; - return false; - } + } function upOption(questionUid, idx){ var orderingArea = "#orderingArea" + questionUid; @@ -327,7 +301,7 @@ ); } - if (${!hasEditRight && mode != "teacher" && !finishedLock}) { + if (${!hasEditRight && mode != "teacher"}) { setInterval("checkLeaderProgress();", 15000);// Auto-Refresh every 15 seconds for non-leaders } @@ -348,7 +322,7 @@ function validateAnswers() { - if (${isEditingDisabled}) { + if (${!hasEditRight}) { return true; } @@ -550,14 +524,6 @@ - - - - ${assessment.passingMark} - - - -

@@ -566,11 +532,9 @@

- -
- -
-
+
+ +
@@ -600,103 +564,21 @@ <%@ include file="/common/messages.jsp"%>
- <%@ include file="parts/attemptsummary.jsp"%> - - -
- <%@ include file="parts/allquestions.jsp"%> -
-
- - <%-- Reflection entry --%> - -
- -
- -
- -
-
- -
- -
- - -

- -

-
- -

- -

-
-
+
+ <%@ include file="parts/allquestions.jsp"%> - - - - - -
- -
-
- + <%@ include file="parts/paging.jsp"%> +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +
Index: lams_tool_assessment/web/pages/learning/parts/allquestions.jsp =================================================================== diff -u -rf5ecfff973a3f012627ce14d2e1d21d5e5e4366f -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/allquestions.jsp (.../allquestions.jsp) (revision f5ecfff973a3f012627ce14d2e1d21d5e5e4366f) +++ lams_tool_assessment/web/pages/learning/parts/allquestions.jsp (.../allquestions.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -1,84 +1,71 @@ <%@ include file="/common/taglibs.jsp"%> -
- + + - + -
-
- - - ${status.index + sessionMap.questionNumberingOffset}. - - +
+
+ + + ${status.index + sessionMap.questionNumberingOffset}. + + - - - " alt=""> - - + + + " + alt=""> + + - - -   - - ${question.question} -
+ + +   + + ${question.question} +
-
+
+ + + <%@ include file="multiplechoice.jsp"%> + + + <%@ include file="matchingpairs.jsp"%> + + + <%@ include file="shortanswer.jsp"%> + + + <%@ include file="numerical.jsp"%> + + + <%@ include file="truefalse.jsp"%> + + + <%@ include file="essay.jsp"%> + + + <%@ include file="ordering.jsp"%> + + + + - - <%@ include file="multiplechoice.jsp"%> + + <%@ include file="../results/markhedging.jsp"%> - - <%@ include file="matchingpairs.jsp"%> - - - <%@ include file="shortanswer.jsp"%> - - - <%@ include file="numerical.jsp"%> - - - <%@ include file="truefalse.jsp"%> - - - <%@ include file="essay.jsp"%> - - - <%@ include file="ordering.jsp"%> - - - - +
<%@ include file="markhedging.jsp"%>
-
+
- - <%@ include file="questionsummary.jsp"%> -
+ + +
-
- - - - - - - +
+
+ Fisheye: Tag c97b41d72e071f6293126bd85f6eba0b756f7836 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/learning/parts/attemptsummary.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/learning/parts/essay.jsp =================================================================== diff -u -r3900618a37feede0762b63edea137223d4f19721 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/essay.jsp (.../essay.jsp) (revision 3900618a37feede0762b63edea137223d4f19721) +++ lams_tool_assessment/web/pages/learning/parts/essay.jsp (.../essay.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -96,9 +96,6 @@ - - ${question.answerString} - @@ -115,5 +112,3 @@
- -<%@ include file="markandpenaltyarea.jsp"%> Fisheye: Tag c97b41d72e071f6293126bd85f6eba0b756f7836 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/learning/parts/markandpenaltyarea.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/learning/parts/markhedging.jsp =================================================================== diff -u -r18ef25d68d237fc9f934df0ccad74e5cd2b08ae4 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/markhedging.jsp (.../markhedging.jsp) (revision 18ef25d68d237fc9f934df0ccad74e5cd2b08ae4) +++ lams_tool_assessment/web/pages/learning/parts/markhedging.jsp (.../markhedging.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -8,29 +8,16 @@
- + - - - - - - - - - +
- - - - - - - - - - - - - - -
- +
- +
- - - - - - - - - - -
- - - ${question.grade} - - - - - - -
-
Index: lams_tool_assessment/web/pages/learning/parts/matchingpairs.jsp =================================================================== diff -u -rdbc7ce0bc9f424c489eea4f884879f052dd867f2 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/matchingpairs.jsp (.../matchingpairs.jsp) (revision dbc7ce0bc9f424c489eea4f884879f052dd867f2) +++ lams_tool_assessment/web/pages/learning/parts/matchingpairs.jsp (.../matchingpairs.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -6,25 +6,13 @@
- + - - -
- - - - - - - - - - + ${selectOption.optionString} @@ -34,6 +22,4 @@
-
- -<%@ include file="markandpenaltyarea.jsp"%> \ No newline at end of file + \ No newline at end of file Index: lams_tool_assessment/web/pages/learning/parts/multiplechoice.jsp =================================================================== diff -u -r2d0422cb41945e1e1b52ad67403354df34fae0aa -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/multiplechoice.jsp (.../multiplechoice.jsp) (revision 2d0422cb41945e1e1b52ad67403354df34fae0aa) +++ lams_tool_assessment/web/pages/learning/parts/multiplechoice.jsp (.../multiplechoice.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -13,33 +13,20 @@
- + - - - - - - - - - -
- - - - - - - - - checked="checked" - disabled="disabled" + disabled="disabled" /> checked="checked" - disabled="disabled" + disabled="disabled" /> @@ -48,35 +35,7 @@ - - - -
-
- - - - - -<%@ include file="markandpenaltyarea.jsp"%> + Index: lams_tool_assessment/web/pages/learning/parts/numerical.jsp =================================================================== diff -u -rc256e3cac813165fce907739b410145e2e809908 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/numerical.jsp (.../numerical.jsp) (revision c256e3cac813165fce907739b410145e2e809908) +++ lams_tool_assessment/web/pages/learning/parts/numerical.jsp (.../numerical.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -7,30 +7,11 @@
- - - -
- - - - - - - disabled="disabled" + disabled="disabled" />
-
- - - - - -<%@ include file="markandpenaltyarea.jsp"%> + Index: lams_tool_assessment/web/pages/learning/parts/ordering.jsp =================================================================== diff -u -rbbaff8bee89447c2711f4636276178bfcd4140c0 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/ordering.jsp (.../ordering.jsp) (revision bbaff8bee89447c2711f4636276178bfcd4140c0) +++ lams_tool_assessment/web/pages/learning/parts/ordering.jsp (.../ordering.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -2,8 +2,6 @@ - -
@@ -13,20 +11,8 @@
- + - - - - - + +
- - - - - - - - @@ -35,34 +21,20 @@ - + - +
- - - - - - <%@ include file="markandpenaltyarea.jsp"%>
Index: lams_tool_assessment/web/pages/learning/parts/paging.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/parts/paging.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/parts/paging.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,18 @@ + + + + \ No newline at end of file Fisheye: Tag c97b41d72e071f6293126bd85f6eba0b756f7836 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/learning/parts/questionsummary.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_assessment/web/pages/learning/parts/shortanswer.jsp =================================================================== diff -u -r18ef25d68d237fc9f934df0ccad74e5cd2b08ae4 -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/shortanswer.jsp (.../shortanswer.jsp) (revision 18ef25d68d237fc9f934df0ccad74e5cd2b08ae4) +++ lams_tool_assessment/web/pages/learning/parts/shortanswer.jsp (.../shortanswer.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -7,30 +7,11 @@
- - - -
- - - - - - - disabled="disabled" + disabled="disabled" />
-
- - - - - -<%@ include file="markandpenaltyarea.jsp"%> + Index: lams_tool_assessment/web/pages/learning/parts/truefalse.jsp =================================================================== diff -u -r2d0422cb41945e1e1b52ad67403354df34fae0aa -rc97b41d72e071f6293126bd85f6eba0b756f7836 --- lams_tool_assessment/web/pages/learning/parts/truefalse.jsp (.../truefalse.jsp) (revision 2d0422cb41945e1e1b52ad67403354df34fae0aa) +++ lams_tool_assessment/web/pages/learning/parts/truefalse.jsp (.../truefalse.jsp) (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -7,60 +7,21 @@
- - - - - -
- - - - - - - - - - - - - - - checked="checked" - disabled="disabled" + disabled="disabled" />
- - - - - - - - - - - - - - checked="checked" - disabled="disabled" + disabled="disabled" /> @@ -69,20 +30,3 @@
- - - - - - - - - - - - -<%@ include file="markandpenaltyarea.jsp"%> Index: lams_tool_assessment/web/pages/learning/results.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,175 @@ + +<%@ include file="/common/taglibs.jsp"%> + + + + + <fmt:message key="label.learning.title" /> + <%@ include file="/common/header.jsp"%> + + + <%-- param has higher level for request attribute --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${assessment.passingMark} + + + + + +

+ + ${sessionMap.groupLeader.firstName} ${sessionMap.groupLeader.lastName} + +

+
+ + <%@ include file="/common/messages.jsp"%> +
+ + <%@ include file="results/attemptsummary.jsp"%> + + +
+ <%@ include file="results/allquestions.jsp"%> + + <%@ include file="parts/paging.jsp"%> +
+
+ + <%-- Reflection entry --%> + +
+ +
+ +
+ +
+
+ +
+ +
+ + +

+ +

+
+ +

+ +

+
+
+ + + + + + +
+ +
+
+
+ + +
+ + + + + + + + + + + + + + + + + +
+
+ +
+ + +
\ No newline at end of file Index: lams_tool_assessment/web/pages/learning/results/allquestions.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/allquestions.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/allquestions.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,63 @@ +<%@ include file="/common/taglibs.jsp"%> + + +
+
+ + + ${status.index + sessionMap.questionNumberingOffset}. + + + + + + " + alt=""> + + + + + +   + + ${question.question} +
+ +
+ + + <%@ include file="multiplechoice.jsp"%> + + + <%@ include file="matchingpairs.jsp"%> + + + <%@ include file="shortanswer.jsp"%> + + + <%@ include file="numerical.jsp"%> + + + <%@ include file="truefalse.jsp"%> + + + <%@ include file="essay.jsp"%> + + + <%@ include file="ordering.jsp"%> + + + + <%@ include file="markhedging.jsp"%> + + + + + <%@ include file="markandpenaltyarea.jsp"%> + + + <%@ include file="historyresponses.jsp"%> +
+ +
+
Index: lams_tool_assessment/web/pages/learning/results/attemptsummary.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/attemptsummary.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/attemptsummary.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + +    +   +
+ :  + + + + + + + + + + + + + + +   +  ${result.maximumGrade} (${resultPercentage}%) +
+ + + +
+
Index: lams_tool_assessment/web/pages/learning/results/essay.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/essay.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/essay.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,15 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ +
+ +
+ + + + +
+ ${question.answerString} +
+
\ No newline at end of file Index: lams_tool_assessment/web/pages/learning/results/historyresponses.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/historyresponses.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/historyresponses.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,111 @@ +<%@ include file="/common/taglibs.jsp"%> + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ # + + + + + + +
+ ${status.index + 1} + +
+ +
+
+ + + + + + ${option.optionString} + + + + + + + + + + + + +
+ ${option.question} + + - + + + + + ${questionOption2.optionString} + + + + +
+
+ + ${questionResult.answerString} + + + ${questionResult.answerString} + + + + ${questionResult.answerBoolean} + + + + ${questionResult.answerString} + + + + + + + + ${option.optionString} + + + + + + +
+
+
+ +
+
+
\ No newline at end of file Index: lams_tool_assessment/web/pages/learning/results/markandpenaltyarea.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/markandpenaltyarea.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/markandpenaltyarea.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,22 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + +
+ + + ${question.grade} + + + + + + + +
+
Index: lams_tool_assessment/web/pages/learning/results/markhedging.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/markhedging.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/markhedging.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,98 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ + ${question.grade} + +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + +
+ + + ${question.grade} + + + + + + +
Index: lams_tool_assessment/web/pages/learning/results/matchingpairs.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/matchingpairs.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/matchingpairs.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,35 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ +
+ +
+ + + + + + + + + + +
+ + + + + + + + + + + + + ${selectOption.optionString} + + +
+
Index: lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/multiplechoice.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,76 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + checked="checked" + disabled="disabled" + /> + + + checked="checked" + disabled="disabled" + /> + + + + + + + + +
+
+ + + + Index: lams_tool_assessment/web/pages/learning/results/numerical.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/numerical.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/numerical.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,32 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ +
+ +
+ + + + + + +
+ + + + + + + + +
+
+ + + + Index: lams_tool_assessment/web/pages/learning/results/ordering.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/ordering.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/ordering.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,45 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + +
+ +
+ +
+ + + + + + + + + +
+ + + + + + + + +
+
+ + + + Index: lams_tool_assessment/web/pages/learning/results/shortanswer.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/shortanswer.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/shortanswer.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,33 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ +
+ +
+ + + + + + +
+ + + + + + + + +
+
+ + + + + Index: lams_tool_assessment/web/pages/learning/results/truefalse.jsp =================================================================== diff -u --- lams_tool_assessment/web/pages/learning/results/truefalse.jsp (revision 0) +++ lams_tool_assessment/web/pages/learning/results/truefalse.jsp (revision c97b41d72e071f6293126bd85f6eba0b756f7836) @@ -0,0 +1,83 @@ +<%@ include file="/common/taglibs.jsp"%> + +
+ +
+ +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + checked="checked" + disabled="disabled" + /> + + +
+ + + + + + + + + + + + + + + checked="checked" + disabled="disabled" + /> + + +
+
+ + + + + + + + + +