Skip to content

Commit

Permalink
SAK-39982 refactor Assignment/Course Grade stats into a reusable panel (
Browse files Browse the repository at this point in the history
sakaiproject#5736)

* SAk-39982 Create some panels

* More work on the new stats panels
SAK-39982

* SAK-39982 Fix the stats for assignments to allow blank increments to be added without affecting the stats spread.
Fix up the window title, the model getting confused with a null and a string arg
Wire up the average GPA stats
mMove the charts to a separate package
Consolidate the properties
Remove JFreechart entirely
SAK-39982

* SAK-39982 Migrate SettingsGradingSchemaPanel to new stats component
Make stats refresh when grading schema changes
Move isDirty into the subclass where it is used
Add doco to the GradebookInfo class, and clean it up
Fix a few other code quality issues
  • Loading branch information
steveswinsburg authored Jul 2, 2018
1 parent 74b472e commit b9b863c
Show file tree
Hide file tree
Showing 20 changed files with 540 additions and 401 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
*/
public class GradebookInformation implements Serializable {
private static final long serialVersionUID = 1L;

private String selectedGradingScaleUid;

/**
* The ID of the GradeMapping that should be used for this gradebook
*/
private String selectedGradeMappingId;

/**
* The list of GradeMappings defined for this gradebook but as a DTO representation
*/
Expand All @@ -46,114 +46,143 @@ public class GradebookInformation implements Serializable {
* The grading schema map currently in use for the this gradebook. For example A+ = 100 etc.
*/
private Map<String, Double> selectedGradingScaleBottomPercents;

private boolean displayReleasedGradeItemsToStudents;
private int gradeType;
private int categoryType;
private List<CategoryDefinition> categories;

/**
* The name of the grading scale, e.g. Pass / Not Pass
*/
private String gradeScale;

/**
* Is the course grade to be shown at all?
*/
private boolean courseGradeDisplayed;
private boolean courseGradeDisplayed;

/**
* If the course grade is displayed, should the letter grade be displayed?
*/
private boolean courseLetterGradeDisplayed;

/**
* If the course grade is displayed, should the total points be displayed?
*/
private boolean coursePointsDisplayed;

/**
* If the course grade is displayed, should the percentage be displayed?
*/
private boolean courseAverageDisplayed;

public String getSelectedGradingScaleUid() {
return selectedGradingScaleUid;
return this.selectedGradingScaleUid;
}
public void setSelectedGradingScaleUid(String selectedGradingScaleUid) {

public void setSelectedGradingScaleUid(final String selectedGradingScaleUid) {
this.selectedGradingScaleUid = selectedGradingScaleUid;
}

public String getSelectedGradeMappingId() {
return selectedGradeMappingId;
return this.selectedGradeMappingId;
}
public void setSelectedGradeMappingId(String selectedGradeMappingId) {

public void setSelectedGradeMappingId(final String selectedGradeMappingId) {
this.selectedGradeMappingId = selectedGradeMappingId;
}

public List<GradeMappingDefinition> getGradeMappings() {
return gradeMappings;
return this.gradeMappings;
}
public void setGradeMappings(List<GradeMappingDefinition> gradeMappings) {

public void setGradeMappings(final List<GradeMappingDefinition> gradeMappings) {
this.gradeMappings = gradeMappings;
}

public Map<String, Double> getSelectedGradingScaleBottomPercents() {
return selectedGradingScaleBottomPercents;
return this.selectedGradingScaleBottomPercents;
}

public void setSelectedGradingScaleBottomPercents(
Map<String, Double> selectedGradingScaleBottomPercents) {
final Map<String, Double> selectedGradingScaleBottomPercents) {
this.selectedGradingScaleBottomPercents = selectedGradingScaleBottomPercents;
}

public boolean isDisplayReleasedGradeItemsToStudents() {
return displayReleasedGradeItemsToStudents;
return this.displayReleasedGradeItemsToStudents;
}

public void setDisplayReleasedGradeItemsToStudents(
boolean displayReleasedGradeItemsToStudents) {
final boolean displayReleasedGradeItemsToStudents) {
this.displayReleasedGradeItemsToStudents = displayReleasedGradeItemsToStudents;
}

public int getGradeType() {
return gradeType;
return this.gradeType;
}
public void setGradeType(int gradeType) {

public void setGradeType(final int gradeType) {
this.gradeType = gradeType;
}

public int getCategoryType() {
return categoryType;
return this.categoryType;
}
public void setCategoryType(int categoryType) {

public void setCategoryType(final int categoryType) {
this.categoryType = categoryType;
}

public String getGradeScale() {
return gradeScale;
return this.gradeScale;
}
public void setGradeScale(String gradeScale) {

public void setGradeScale(final String gradeScale) {
this.gradeScale = gradeScale;
}

public boolean isCourseGradeDisplayed() {
return courseGradeDisplayed;
return this.courseGradeDisplayed;
}
public void setCourseGradeDisplayed(boolean courseGradeDisplayed) {

public void setCourseGradeDisplayed(final boolean courseGradeDisplayed) {
this.courseGradeDisplayed = courseGradeDisplayed;
}

public List<CategoryDefinition> getCategories() {
return categories;
return this.categories;
}
public void setCategories(List<CategoryDefinition> categories) {

public void setCategories(final List<CategoryDefinition> categories) {
this.categories = categories;
}

public boolean isCourseLetterGradeDisplayed() {
return courseLetterGradeDisplayed;
return this.courseLetterGradeDisplayed;
}
public void setCourseLetterGradeDisplayed(boolean courseLetterGradeDisplayed) {

public void setCourseLetterGradeDisplayed(final boolean courseLetterGradeDisplayed) {
this.courseLetterGradeDisplayed = courseLetterGradeDisplayed;
}

public boolean isCoursePointsDisplayed() {
return coursePointsDisplayed;
return this.coursePointsDisplayed;
}
public void setCoursePointsDisplayed(boolean coursePointsDisplayed) {

public void setCoursePointsDisplayed(final boolean coursePointsDisplayed) {
this.coursePointsDisplayed = coursePointsDisplayed;
}

public boolean isCourseAverageDisplayed() {
return courseAverageDisplayed;
return this.courseAverageDisplayed;
}
public void setCourseAverageDisplayed(boolean courseAverageDisplayed) {

public void setCourseAverageDisplayed(final boolean courseAverageDisplayed) {
this.courseAverageDisplayed = courseAverageDisplayed;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
Expand Down
5 changes: 0 additions & 5 deletions gradebookng/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@
<artifactId>spring-beans</artifactId>
<scope>provided</scope> <!-- to satisfy EB and eclipse -->
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,33 +514,22 @@ no-students.label = There are no students to display

gradebookpage.uncategorised = Uncategorized

label.statistics.title = Grade Statistics for {0}
label.statistics.average = Average (Mean) Score
label.statistics.averagevalue = {0} / {1} ({2})
label.statistics.graded = Total Graded Scores
label.statistics.median = Median Score
label.statistics.medianvalue = {0} / {1} ({2})
label.statistics.lowest = Lowest Score
label.statistics.lowestvalue = {0} / {1} ({2})
label.statistics.highest = Highest Score
label.statistics.highestvalue = {0} / {1} ({2})
label.statistics.deviation = Standard Deviation
label.statistics.title.assignment = Grade Statistics for {0}
label.statistics.title.coursegrade = Course Grade Statistics
label.statistics.average = Average (mean) grade
label.statistics.graded = Total graded
label.statistics.median = Median grade
label.statistics.lowest = Lowest grade
label.statistics.highest = Highest grade
label.statistics.deviation = Standard deviation
label.statistics.averagegpa = Course Average GPA
label.statistics.chart.extracredit = EC
label.statistics.chart.xaxis = Percentage Scored
label.statistics.chart.yaxis = Number of Students
label.statistics.chart.tooltip = {2} score(s) in {1} range
label.statistics.chart.range={0}-{1}
label.statistics.chart.title=Grade Distribution

label.statistics.coursegrade.title = Course Grade Statistics
label.statistics.coursegrade.averagegpa = Course Average GPA
label.statistics.coursegrade.average = Average grade
label.statistics.coursegrade.graded = Total graded students
label.statistics.coursegrade.median = Median grade
label.statistics.coursegrade.lowest = Lowest grade
label.statistics.coursegrade.highest = Highest grade
label.statistics.coursegrade.deviation = Standard deviation

coursegrade.option.override = Course Grade Override
coursegrade.option.overridelog = Course Grade Override Log
coursegrade.option.setungraded = Set Zero Score For Empty Cells
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sakaiproject.gradebookng.tool.component;
package org.sakaiproject.gradebookng.tool.chart;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -17,13 +17,13 @@
/**
* Panel that renders the individual assignment grade charts
*/
public class GbAssignmentGradeChart extends GbBaseChart {
public class AssignmentGradeChart extends BaseChart {

private static final long serialVersionUID = 1L;

private final long assignmentId;

public GbAssignmentGradeChart(final String id, final long assignmentId) {
public AssignmentGradeChart(final String id, final long assignmentId) {
super(id);
this.assignmentId = assignmentId;
}
Expand Down Expand Up @@ -59,12 +59,12 @@ protected GbChartData getData() {
final GbChartData data = new GbChartData();

// Add 0-50% range
data.add(buildRangeLabel(0, 50));
data.addZeroed(buildRangeLabel(0, 50));

// Add all ranges from 50 up to 100 in increments of 10.
final int range = 10;
for (int start = 50; start < 100; start = start + range) {
data.add(buildRangeLabel(start, start + range));
data.addZeroed(buildRangeLabel(start, start + range));
}

for (final Double grade : allGrades) {
Expand All @@ -80,7 +80,7 @@ protected GbChartData getData() {
percentage = grade / assignment.getPoints() * 100;
}

//determine key for this grade
// determine key for this grade
final int total = Double.valueOf(Math.ceil(percentage) / range).intValue();

int start = total * range;
Expand Down Expand Up @@ -118,7 +118,6 @@ private String buildRangeLabel(final int start, final int end) {
return new StringResourceModel("label.statistics.chart.range", null, start, end).getString();
}


/**
* Check if a grade is considered extra credit
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sakaiproject.gradebookng.tool.component;
package org.sakaiproject.gradebookng.tool.chart;

import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
Expand All @@ -15,19 +15,19 @@
import lombok.extern.slf4j.Slf4j;

/**
* Base panel for gradebook charts. See {@link GbCourseGradeChart} or {@link GbAssignmentGradeChart}.
* Base panel for gradebook charts. See {@link CourseGradeChart} or {@link AssignmentGradeChart}.
*
* Immediately renders itself with the base data. Subclasses may provide a refresh option.
*/
@Slf4j
public abstract class GbBaseChart extends WebComponent {
public abstract class BaseChart extends WebComponent {

private static final long serialVersionUID = 1L;

@SpringBean(name = "org.sakaiproject.gradebookng.business.GradebookNgBusinessService")
protected transient GradebookNgBusinessService businessService;

public GbBaseChart(final String id) {
public BaseChart(final String id) {
super(id);
setOutputMarkupPlaceholderTag(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sakaiproject.gradebookng.tool.component;
package org.sakaiproject.gradebookng.tool.chart;

import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -14,13 +14,13 @@
/**
* Panel that renders the course grade chart for a site.
*/
public class GbCourseGradeChart extends GbBaseChart {
public class CourseGradeChart extends BaseChart {

private static final long serialVersionUID = 1L;

private final String siteId;

public GbCourseGradeChart(final String id, final String siteId) {
public CourseGradeChart(final String id, final String siteId) {
super(id);
this.siteId = siteId;
}
Expand Down
Loading

0 comments on commit b9b863c

Please sign in to comment.