Skip to content

Commit

Permalink
SAK-40646: SiteStats no longer tracks Gradebook events (sakaiproject#…
Browse files Browse the repository at this point in the history
  • Loading branch information
plukasew authored and ern committed Sep 18, 2018
1 parent 32daae4 commit 6122f0d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,29 @@

<!-- gradebook (available in sakai 2.4+) -->
<!-- (see SAK-6207 and SAK-10802) -->
<tool
toolId="sakai.gradebook.tool"
<tool
toolId="sakai.gradebookng"
additionalToolIds="sakai.gradebook.tool"
selected="true">
<event eventId="gradebook.newItem" selected="true"/>
<event eventId="gradebook.updateAssignment" selected="true"/>
<event eventId="gradebook.deleteItem" selected="true"/>
<event eventId="gradebook.updateItemScore" selected="true"/>
<event eventId="gradebook.updateUngradedScores" selected="true"/>
<event eventId="gradebook.comment" selected="true"/>
<event eventId="gradebook.studentView" selected="true"/>
<event eventId="gradebook.export" selected="true"/>
<event eventId="gradebook.importBegin" selected="true"/>
<event eventId="gradebook.importCompleted" selected="true"/>
<event eventId="gradebook.overrideCourseGrade" selected="true"/>
<event eventId="gradebook.updateSettings" selected="true"/>
<!-- legacy Gradebook Classic events, included here to retain historical statistics -->
<event eventId="gradebook.updateItemScores" selected="true"/>
<event eventId="gradebook.updateCourseGrades" selected="true"/>
<event eventId="gradebook.comment" selected="true"/>
<event eventId="gradebook.downloadRoster" selected="true"/>
<event eventId="gradebook.downloadCourseGrade " selected="true"/>
<event eventId="gradebook.importEntire" selected="true"/>
<event eventId="gradebook.importItem" selected="true"/>
<event eventId="gradebook.importItem" selected="true"/>
<eventParserTip for="contextId" separator="/" index="2"/>
</tool>

Expand Down
23 changes: 16 additions & 7 deletions sitestats/sitestats-bundle/src/resources/Events.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,25 @@ disc.delete.any=Discussion topic/message delete (other)
disc.delete.own=Discussion topic/message delete (own)
disc.delete.category=Discussion category delete

# gradebook
# gradebook / gradebookng
gradebook.updateItemScores=Gradebook Classic item scores update
gradebook.updateCourseGrades=Gradebook Classic course scores update
gradebook.downloadRoster=Gradebook Classic roster download
gradebook.downloadCourseGrade=Gradebook Classic course grade download
gradebook.importEntire=Gradebook Classic course grades import
gradebook.importItem=Gradebook Classic item import
gradebook.newItem=Gradebook item new
gradebook.deleteItem=Gradebook item delete
gradebook.updateItemScores=Gradebook item scores update
gradebook.updateCourseGrades=Gradebook course scores update
gradebook.comment=Gradebook comment
gradebook.downloadRoster=Gradebook roster download
gradebook.downloadCourseGrade=Gradebook course grade
gradebook.importEntire=Gradebook course grades import
gradebook.importItem=Gradebook item import
gradebook.updateAssignment=Gradebook item update
gradebook.updateItemScore=Gradebook item update score
gradebook.updateUngradedScores=Gradebook update ungraded scores
gradebook.studentView=Gradebook student view
gradebook.export=Gradebook export
gradebook.importBegin=Gradebook begin import
gradebook.importCompleted=Gradebook import complete
gradebook.overrideCourseGrade=Gradebook override course grade
gradebook.updateSettings=Gradebook update settings

# mail
mail.new=Mail new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ public PrefsData getPreferences(final String siteId, final boolean includeUnsele
try{
// parse from stored preferences
prefsdata = parseSitePrefs(new ByteArrayInputStream(prefs.getPrefs().getBytes()));
// preferences doesn't store additionalToolIds, add them back
EventUtil.addMissingAdditionalToolIds(prefsdata.getToolEventsDef(), M_ers.getEventRegistry());
}catch(Exception e){
// something failed, use default
log.warn("Exception in parseSitePrefs() ",e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.collections4.ListUtils;

import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.site.api.Site;
Expand Down Expand Up @@ -77,8 +78,7 @@ public static List<ToolInfo> getIntersectionWithAvailableToolsInSite(SiteService
ToolInfo t = iTED.next();
Iterator<ToolConfiguration> iST = siteTools.iterator();
while (iST.hasNext()){
ToolConfiguration tc = iST.next();
if(tc.getToolId().equals(t.getToolId())){
if(intersects(iST.next().getToolId(), t)){
intersected.add(t);
break;
}
Expand Down Expand Up @@ -107,8 +107,7 @@ public static List<ToolInfo> getIntersectionWithAvailableToolsInSakaiInstallatio
ToolInfo t = iTED.next();
Iterator<org.sakaiproject.tool.api.Tool> iST = sakaiTools.iterator();
while (iST.hasNext()){
org.sakaiproject.tool.api.Tool tc = iST.next();
if(tc.getId().equals(t.getToolId())){
if(intersects(iST.next().getId(), t)) {
intersected.add(t);
break;
}
Expand All @@ -118,6 +117,11 @@ public static List<ToolInfo> getIntersectionWithAvailableToolsInSakaiInstallatio
return intersected;
}

private static boolean intersects(String siteToolId, ToolInfo regTool) {
List<String> aliasIds = ListUtils.emptyIfNull(regTool.getAdditionalToolIds());
return siteToolId.equals(regTool.getToolId()) || aliasIds.contains(siteToolId);
}

/**
* Union between a given event registry with the full Event Registry.
* @param eventRegistrySubset The Event Registry to union with.
Expand Down

0 comments on commit 6122f0d

Please sign in to comment.