Index: samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/EvaluationMessages.properties
===================================================================
--- samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/EvaluationMessages.properties (revision 309906)
+++ samigo-app/src/java/org/sakaiproject/tool/assessment/bundle/EvaluationMessages.properties (working copy)
@@ -302,3 +302,7 @@
data_discrepancy_title=Data Discrepancy
data_discrepancy_1=You are seeing this page because you are grading this assessement in multiple browser windows.
data_discrepancy_2=Please close all windows except one.
+
+obj=Objectives
+keywords=Keywords
+objPercent=Percent Correct
Index: samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramScoresBean.java
===================================================================
--- samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramScoresBean.java (revision 309906)
+++ samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramScoresBean.java (working copy)
@@ -28,6 +28,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
@@ -89,6 +90,9 @@
private boolean randomType; // true = has at least one random draw part
private List assesmentParts = new ArrayList();
private List selectItemParts = new ArrayList();
+ private boolean showObjectivesColumn;
+ private List> objectives;
+ private List> keywords;
private static Log log = LogFactory.getLog(HistogramScoresBean.class);
@@ -966,6 +970,36 @@
public void setDetailedStatistics(Collection detailedStatistics) {
this.detailedStatistics = detailedStatistics;
}
+
+ public boolean getShowObjectivesColumn()
+ {
+ return showObjectivesColumn;
+ }
+
+ public void setShowObjectivesColumn(boolean showObjectivesColumn)
+ {
+ this.showObjectivesColumn = showObjectivesColumn;
+ }
+
+ public List> getObjectives()
+ {
+ return objectives;
+ }
+
+ public void setObjectives(List> objectives)
+ {
+ this.objectives = objectives;
+ }
+
+ public List> getKeywords()
+ {
+ return keywords;
+ }
+
+ public void setKeywords(List> keywords)
+ {
+ this.keywords = keywords;
+ }
public boolean getShowDiscriminationColumn() {
try {
Index: samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java
===================================================================
--- samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java (revision 309906)
+++ samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramQuestionScoresBean.java (working copy)
@@ -105,6 +105,9 @@
private static Log log = LogFactory.getLog(HistogramQuestionScoresBean.class);
+ private String objectives;
+ private String keywords;
+
/**
* Creates a new HistogramQuestionScoresBean object.
*/
@@ -1128,6 +1131,21 @@
return responses;
}
}
+
+ public String getObjectives() {
+ return objectives;
+ }
+
+ public void setObjectives(String objectives) {
+ this.objectives = objectives;
+ }
+
+ public String getKeywords() {
+ return keywords;
+ }
+
+ public void setKeywords(String keywords) {
+ this.keywords = keywords;
+ }
-
}
Index: samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java
===================================================================
--- samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java (revision 309906)
+++ samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/evaluation/HistogramListener.java (working copy)
@@ -7,12 +7,16 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.context.FacesContext;
@@ -33,6 +37,7 @@
import org.sakaiproject.tool.assessment.data.ifc.assessment.AnswerIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc;
+import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemMetaDataIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc;
import org.sakaiproject.tool.assessment.facade.AgentFacade;
@@ -50,6 +55,7 @@
import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil;
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
+import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc;
import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean;
import org.sakaiproject.tool.assessment.ui.bean.evaluation.ItemBarBean;
@@ -322,6 +328,12 @@
}
}
+ boolean showObjectivesColumn = Boolean.parseBoolean(pub.getAssessmentMetaDataByLabel(AssessmentBaseIfc.HASMETADATAFORQUESTIONS));
+ Map objectivesCorrect = new HashMap();
+ Map objectivesCounter = new HashMap();
+ Map keywordsCorrect = new HashMap();
+ Map keywordsCounter = new HashMap();
+
assessmentName = pub.getTitle();
ArrayList parts = pub.getSectionArraySorted();
@@ -405,6 +417,13 @@
questionScores.setPoolName(poolName);
ItemDataIfc item = (ItemDataIfc) itemsIter.next();
+ if (showObjectivesColumn) {
+ String obj = item.getItemMetaDataByLabel(ItemMetaDataIfc.OBJECTIVE);
+ questionScores.setObjectives(obj);
+ String key = item.getItemMetaDataByLabel(ItemMetaDataIfc.KEYWORD);
+ questionScores.setKeywords(key);
+ }
+
//String type = delegate.getTextForId(item.getTypeId());
String type = getType(item.getTypeId().intValue());
if (item.getSequence() == null)
@@ -553,12 +572,81 @@
maxNumOfAnswers = questionScores.getHistogramBars().length >maxNumOfAnswers ? questionScores.getHistogramBars().length : maxNumOfAnswers;
}
}
+
+ if (showObjectivesColumn) {
+ // Get the percentage correct by objective
+ String obj = questionScores.getObjectives();
+ String[] objs = obj.split(",");
+ for (int i=0; i < objs.length; i++) {
+ if (objectivesCorrect.get(objs[i]) != null) {
+ int divisor = objectivesCounter.get(objs[i]) + 1;
+ // newavg = avg + ((q3 - avg)/index)
+ Double newAvg = objectivesCorrect.get(objs[i]) + (
+ (Double.parseDouble(questionScores.getPercentCorrect()) - objectivesCorrect.get(objs[i])
+ ) / divisor);
+
+ newAvg = new BigDecimal(newAvg).setScale(2, RoundingMode.HALF_UP).doubleValue();
+
+ objectivesCounter.put(objs[i], divisor);
+ objectivesCorrect.put(objs[i], newAvg);
+ } else {
+ Double newAvg = Double.parseDouble(questionScores.getPercentCorrect());
+ newAvg = new BigDecimal(newAvg).setScale(2, RoundingMode.HALF_UP).doubleValue();
+
+ objectivesCounter.put(objs[i], 1);
+ objectivesCorrect.put(objs[i], newAvg);
+ }
+ }
+
+ // Get the percentage correct by keyword
+ String key = questionScores.getKeywords();
+ String [] keys = key.split(",");
+ for (int i=0; i < keys.length; i++) {
+ if (keywordsCorrect.get(keys[i]) != null) {
+ int divisor = keywordsCounter.get(keys[i]) + 1;
+ Double newAvg = keywordsCorrect.get(keys[i]) + (
+ (Double.parseDouble(questionScores.getPercentCorrect()) - keywordsCorrect.get(keys[i])
+ ) / divisor);
+
+ newAvg = new BigDecimal(newAvg).setScale(2, RoundingMode.HALF_UP).doubleValue();
+
+ keywordsCounter.put(keys[i], divisor);
+ keywordsCorrect.put(keys[i], newAvg);
+ } else {
+ Double newAvg = Double.parseDouble(questionScores.getPercentCorrect());
+ newAvg = new BigDecimal(newAvg).setScale(2, RoundingMode.HALF_UP).doubleValue();
+
+ keywordsCounter.put(keys[i], 1);
+ keywordsCorrect.put(keys[i], newAvg);
+ }
+ }
+ }
+
}
histogramScores.setDetailedStatistics(detailedStatistics);
histogramScores.setMaxNumberOfAnswers(maxNumOfAnswers);
// above - gopalrc Dec 2007
+ histogramScores.setShowObjectivesColumn(showObjectivesColumn);
+ if (showObjectivesColumn) {
+ List> objectivesList = new ArrayList>(objectivesCorrect.entrySet());
+ Collections.sort(objectivesList, new Comparator>() {
+ public int compare(Entry e1, Entry e2) {
+ return e1.getKey().compareTo(e2.getKey());
+ }
+ });
+ histogramScores.setObjectives(objectivesList);
+ List> keywordsList = new ArrayList>(keywordsCorrect.entrySet());
+
+ Collections.sort(keywordsList, new Comparator>() {
+ public int compare(Entry e1, Entry e2) {
+ return e1.getKey().compareTo(e2.getKey());
+ }
+ });
+ histogramScores.setKeywords(keywordsList);
+ }
+
/*
* gopalrc - moved up (1)
// here scores contain AssessmentGradingData
Index: samigo-app/src/webapp/jsf/evaluation/detailedStatistics.jsp
===================================================================
--- samigo-app/src/webapp/jsf/evaluation/detailedStatistics.jsp (revision 309906)
+++ samigo-app/src/webapp/jsf/evaluation/detailedStatistics.jsp (working copy)
@@ -203,6 +203,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: samigo-app/src/webapp/jsf/evaluation/histogramScores.jsp
===================================================================
--- samigo-app/src/webapp/jsf/evaluation/histogramScores.jsp (revision 309906)
+++ samigo-app/src/webapp/jsf/evaluation/histogramScores.jsp (working copy)
@@ -198,6 +198,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: CUSTOMIZATIONS.txt
===================================================================
--- CUSTOMIZATIONS.txt (revision 309906)
+++ CUSTOMIZATIONS.txt (working copy)
@@ -44,6 +44,7 @@
03/28/2014 Merging up to revision: 307597
SAM-2097 Download PDF function in Print view creates unusuable file when link added to question or part with rich-text editor
SAM-1660 Patch for samigo to participate in archive/merge
+SAM-2287 If instructor enters question-level metadata, display statistics on those Objectives and Keywords
----------------------
Removed from backport
----------------------