diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java index 01ae37eed418..ceb3eef5d20a 100755 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/TotalScoreListener.java @@ -574,9 +574,16 @@ public void prepareAgentResultList(TotalScoresBean bean, PublishedAssessmentData PublishedAccessControl ac = (PublishedAccessControl) p.getAssessmentAccessControl(); if (ac.getUnlimitedSubmissions()!=null && !ac.getUnlimitedSubmissions().booleanValue()){ if (ac.getSubmissionsAllowed().intValue() == 1) { - bean.setAllSubmissions(TotalScoresBean.LAST_SUBMISSION); - ((QuestionScoresBean) ContextUtil.lookupBean("questionScores")).setAllSubmissions(TotalScoresBean.LAST_SUBMISSION); - ((HistogramScoresBean) ContextUtil.lookupBean("histogramScores")).setAllSubmissions(TotalScoresBean.LAST_SUBMISSION); + // although the assessment is currently set to allow one submission, multiple submissions may still exist. Set + // the bean to display either the latest or the highest score, as defined in the assessment settings. + Integer scoringType = p.getEvaluationModel().getScoringType(); + String scoringTypeStr = scoringType != null ? scoringType.toString() : TotalScoresBean.LAST_SUBMISSION; + if (TotalScoresBean.LAST_SUBMISSION.equals(scoringTypeStr) || TotalScoresBean.HIGHEST_SUBMISSION.equals(scoringTypeStr)) + { + bean.setAllSubmissions(scoringTypeStr); + ((QuestionScoresBean) ContextUtil.lookupBean("questionScores")).setAllSubmissions(scoringTypeStr); + ((HistogramScoresBean) ContextUtil.lookupBean("histogramScores")).setAllSubmissions(scoringTypeStr); + } } } diff --git a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java index 0497ede70cae..c146105d1d80 100644 --- a/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java +++ b/samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacadeQueries.java @@ -2272,20 +2272,16 @@ public Object doInHibernate(Session session) List l = getHibernateTemplate().executeFind(eval_model); HashMap scoringTypeMap = new HashMap(); - HashMap subissionAllowedMap = new HashMap(); Iterator iter = l.iterator(); while (iter.hasNext()) { Object o[] = (Object[]) iter.next(); scoringTypeMap.put(o[0], o[1]); - subissionAllowedMap.put(o[0], o[2]); } // The sorting for each column will be done in the action listener. ArrayList assessmentList = new ArrayList(); Long currentid = new Long("0"); Integer scoringOption = EvaluationModelIfc.LAST_SCORE; // use Last as - Integer submissionAllowed = null; - boolean multiSubmissionAllowed = false; // now go through the last_list, and get the first entry in the list for // each publishedAssessment, if @@ -2302,25 +2298,14 @@ public Object doInHibernate(Session session) // I use Last as default because it is what set above scoringOption = EvaluationModelIfc.LAST_SCORE; } - if (subissionAllowedMap.get(a.getPublishedAssessmentId()) != null) { - submissionAllowed = (Integer) subissionAllowedMap.get(a.getPublishedAssessmentId()); - } - else { - submissionAllowed = null; - } - if (submissionAllowed != null) { - if (submissionAllowed.intValue() == 1) { - scoringOption = EvaluationModelIfc.LAST_SCORE; - } - } if (EvaluationModelIfc.LAST_SCORE.equals(scoringOption)) { if (!a.getPublishedAssessmentId().equals(currentid) || allAssessments) { - AssessmentGradingData f = a; + if (!a.getPublishedAssessmentId().equals(currentid)) { - f.setIsRecorded(true); + a.setIsRecorded(true); } - assessmentList.add(f); + assessmentList.add(a); currentid = a.getPublishedAssessmentId(); } } @@ -2329,6 +2314,7 @@ public Object doInHibernate(Session session) // now go through the highest_list ,and get the first entry in the list // for each publishedAssessment. + currentid = 0L; for (int i = 0; i < highest_list.size(); i++) { AssessmentGradingData a = (AssessmentGradingData) highest_list .get(i); @@ -2341,38 +2327,21 @@ public Object doInHibernate(Session session) // I use Last as default because it is what set above scoringOption = EvaluationModelIfc.LAST_SCORE; } - if (subissionAllowedMap.get(a.getPublishedAssessmentId()) != null) { - submissionAllowed = (Integer) subissionAllowedMap.get(a.getPublishedAssessmentId()); - } - else { - submissionAllowed = null; - } - if (submissionAllowed != null) { - if (submissionAllowed.intValue() > 1) { - multiSubmissionAllowed = true; - } - else { - multiSubmissionAllowed = false; - } - } - else { - multiSubmissionAllowed = true; - } - if (multiSubmissionAllowed && (EvaluationModelIfc.HIGHEST_SCORE.equals(scoringOption))) { + if (EvaluationModelIfc.HIGHEST_SCORE.equals(scoringOption)) { if (!a.getPublishedAssessmentId().equals(currentid) || allAssessments) { - AssessmentGradingData f = a; + if (!a.getPublishedAssessmentId().equals(currentid)) { - f.setIsRecorded(true); + a.setIsRecorded(true); } - assessmentList.add(f); + assessmentList.add(a); currentid = a.getPublishedAssessmentId(); } } if (EvaluationModelIfc.AVERAGE_SCORE.equals(scoringOption)) { - AssessmentGradingData f = a; - assessmentList.add(f); + + assessmentList.add(a); } }