Skip to content

Commit

Permalink
SAK-41502: Excusing an individual grade should be reflected in Grade …
Browse files Browse the repository at this point in the history
…Log scores (sakaiproject#8364)
  • Loading branch information
victorGomollon authored Dec 3, 2020
1 parent b8e3b02 commit 5ff84b8
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.sakaiproject.service.gradebook.shared;

// The order of this enum is important.
// Do not modify or delete items. If changes are needed, add values only at the end
// TO-DO: Create a custom class to parse it to Integer
public enum GradingEventStatus {
GRADE_NONE,
GRADE_EXCLUDED,
GRADE_INCLUDED
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
<property name="studentId" column="STUDENT_ID" type="string" not-null="true"/>
<property name="dateGraded" column="DATE_GRADED" type="timestamp" not-null="true"/>
<property name="grade" column="GRADE" type="string" />

<property name="status" column="IS_EXCLUDED">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">org.sakaiproject.service.gradebook.shared.GradingEventStatus</param>
</type>
</property>
</class>

<database-object>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.Serializable;
import java.util.Date;

import org.sakaiproject.service.gradebook.shared.GradingEventStatus;
/**
* A log of grading activity. A GradingEvent should be saved any time a grade
* record is added or modified. GradingEvents should be added when the entered
Expand All @@ -37,6 +38,7 @@ public class GradingEvent implements Comparable<Object>, Serializable {
private GradableObject gradableObject;
private String grade;
private Date dateGraded;
private GradingEventStatus status;

public GradingEvent() {
this.dateGraded = new Date();
Expand All @@ -50,6 +52,7 @@ public GradingEvent(GradableObject gradableObject, String graderId, String stude
this.grade = grade.toString();
}
this.dateGraded = new Date();
this.status = GradingEventStatus.GRADE_NONE;
}

public Date getDateGraded() {
Expand Down Expand Up @@ -100,6 +103,14 @@ public void setStudentId(String studentId) {
this.studentId = studentId;
}

public GradingEventStatus getStatus() {
return status;
}

public void setStatus(GradingEventStatus status) {
this.status = status;
}

/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.sakaiproject.service.gradebook.shared.GradebookPermissionService;
import org.sakaiproject.service.gradebook.shared.GradebookSecurityException;
import org.sakaiproject.service.gradebook.shared.GradebookService;
import org.sakaiproject.service.gradebook.shared.GradingEventStatus;
import org.sakaiproject.service.gradebook.shared.InvalidGradeException;
import org.sakaiproject.service.gradebook.shared.SortType;
import org.sakaiproject.service.gradebook.shared.StaleObjectModificationException;
Expand Down Expand Up @@ -2006,6 +2007,11 @@ public void saveGradesAndComments(final String gradebookUid, final Long gradable

// Add a GradingEvent, which stores the actual input grade rather than the converted one
final GradingEvent event = new GradingEvent(assignment, graderId, studentId, newGrade);
if(excuse != currentExcuse) {
event.setStatus(excuse ?
GradingEventStatus.GRADE_EXCLUDED :
GradingEventStatus.GRADE_INCLUDED);
}
eventsToAdd.add(event);
}
} else {
Expand All @@ -2019,6 +2025,11 @@ public void saveGradesAndComments(final String gradebookUid, final Long gradable

// Add a GradingEvent, which stores the actual input grade rather than the converted one
final GradingEvent event = new GradingEvent(assignment, graderId, studentId, newGrade);
if(excuse != currentExcuse) {
event.setStatus(excuse ?
GradingEventStatus.GRADE_EXCLUDED:
GradingEventStatus.GRADE_INCLUDED);
}
eventsToAdd.add(event);
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradebookng/bundle/src/main/bundle/gradebookng.properties
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ grade.log.entry = {0} - Score set to <b>{1}</b> by {2}
grade.log.none = No grades have been entered for this cell.
grade.outof = /{0}
grade.menulabel = Open menu for student {0} and assignment {1} cell
grade.log.excluded={0} - Score of <b>{1}</b> excused by {2}
grade.log.included={0} - Score of <b>{1}</b> included by {2}

grade.notifications.hascomment = Gradebook item has comments
grade.notifications.commentloading = Loading comment...
Expand Down
2 changes: 2 additions & 0 deletions gradebookng/bundle/src/main/bundle/gradebookng_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ grade.log.entry={0} - Nota puesta a <b>{1}</b> por {2}
grade.log.none=No se han introducido notas para esta casilla.
grade.outof=/{0}
grade.menulabel=Abrir el men\u00fa de la casilla para el estudiante {0} y tarea {1}
grade.log.excluded={0} - Nota <b>{1}</b> excluida por {2}
grade.log.included={0} - Nota <b>{1}</b> incluida por {2}

grade.notifications.hascomment=El \u00edtem de calificaci\u00f3n tiene comentarios
grade.notifications.commentloading=Cargando el comentario...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Date;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.sakaiproject.service.gradebook.shared.GradingEventStatus;
import org.sakaiproject.tool.gradebook.GradingEvent;

import lombok.Getter;
Expand All @@ -41,11 +42,15 @@ public class GbGradeLog implements Serializable {

@Getter
private final String grade;


@Getter
private final GradingEventStatus status;

public GbGradeLog(final GradingEvent ge) {
this.dateGraded = ge.getDateGraded();
this.graderUuid = ge.getGraderId();
this.grade = ge.getGrade();
this.status = ge.getStatus();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.sakaiproject.gradebookng.business.model.GbUser;
import org.sakaiproject.gradebookng.business.util.FormatHelper;
import org.sakaiproject.gradebookng.tool.component.GbAjaxLink;
import org.sakaiproject.service.gradebook.shared.GradingEventStatus;

/**
* Panel for the grade log window
Expand Down Expand Up @@ -76,10 +77,19 @@ protected void populateItem(final ListItem<GbGradeLog> item) {
final String graderDisplayId = (grader != null) ? grader.getDisplayName() + " (" + grader.getDisplayId() + ")" : getString("unknown.user.id");

// add the entry
item.add(new Label("entry",
new StringResourceModel("grade.log.entry", null, new Object[] { logDate, grade, graderDisplayId }))
.setEscapeModelStrings(false));

if(gradeLog.getStatus() == GradingEventStatus.GRADE_NONE) {
item.add(new Label("entry",
new StringResourceModel("grade.log.entry", null, new Object[] { logDate, grade, graderDisplayId }))
.setEscapeModelStrings(false));
}else if(gradeLog.getStatus() == GradingEventStatus.GRADE_EXCLUDED) {
item.add(new Label("entry",
new StringResourceModel("grade.log.excluded", null, new Object[] { logDate, grade, graderDisplayId }))
.setEscapeModelStrings(false));
}else {
item.add(new Label("entry",
new StringResourceModel("grade.log.included", null, new Object[] { logDate, grade, graderDisplayId }))
.setEscapeModelStrings(false));
}
}
};
add(listView);
Expand Down

0 comments on commit 5ff84b8

Please sign in to comment.