Added grading models

This commit is contained in:
Andrew Lalis 2019-03-03 09:29:45 +01:00 committed by andrewlalis
parent 672bafbfcf
commit 16bf623a06
4 changed files with 103 additions and 3 deletions

View File

@ -0,0 +1,34 @@
package nl.andrewlalis.teaching_assistant_assistant.model.assignments.grades;
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
import nl.andrewlalis.teaching_assistant_assistant.model.assignments.Assignment;
import javax.persistence.*;
import java.util.List;
/**
* Represents a grade for a certain student's submission for an assignment.
*/
@Entity
public class AssignmentGrade extends BasicEntity {
/**
* The assignment to which this grade belongs.
*/
@ManyToOne(
fetch = FetchType.LAZY,
optional = false
)
private Assignment assignment;
/**
* The list of section grades which make up this total grade.
*/
@OneToMany(
fetch = FetchType.EAGER,
orphanRemoval = true
)
@JoinColumn(name = "assignmentGrade_id")
private List<SectionGrade> sectionGrades;
}

View File

@ -1,4 +1,4 @@
package nl.andrewlalis.teaching_assistant_assistant.model.assignments;
package nl.andrewlalis.teaching_assistant_assistant.model.assignments.grades;
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
@ -14,13 +14,13 @@ import javax.persistence.*;
public abstract class Feedback extends BasicEntity {
/**
* The section to which this feedback belongs.
* The graded section to which this feedback belongs.
*/
@ManyToOne(
fetch = FetchType.LAZY,
optional = false
)
private AssignmentSection assignmentSection;
private SectionGrade assignmentSection;

View File

@ -0,0 +1,53 @@
package nl.andrewlalis.teaching_assistant_assistant.model.assignments.grades;
import nl.andrewlalis.teaching_assistant_assistant.model.BasicEntity;
import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant;
import javax.persistence.*;
/**
* A grade for a particular section of a student's submission. This is the basic unit which makes up a grade.
*/
@Entity
public class SectionGrade extends BasicEntity {
/**
* The teaching assistant responsible for giving this grade.
*/
@ManyToOne(
fetch = FetchType.LAZY,
optional = false
)
private TeachingAssistant teachingAssistant;
/**
* The overall grade to which this section grade belongs.
*/
@ManyToOne(
fetch = FetchType.EAGER,
optional = false
)
private AssignmentGrade assignmentGrade;
/**
* The feedback object for this particular section grade.
*/
@OneToOne(
optional = false
)
private Feedback feedback;
/**
* The grade for this section.
*/
@Column
private float grade;
public SectionGrade(float grade, Feedback feedback, TeachingAssistant teachingAssistant, AssignmentGrade assignmentGrade) {
this.grade = grade;
this.feedback = feedback;
this.teachingAssistant = teachingAssistant;
this.assignmentGrade = assignmentGrade;
}
}

View File

@ -1,10 +1,23 @@
package nl.andrewlalis.teaching_assistant_assistant.model.people;
import nl.andrewlalis.teaching_assistant_assistant.model.assignments.grades.SectionGrade;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import java.util.List;
/**
* Represents a teaching assistant of a course, or in other words, a grader and administrator.
*/
@Entity
public class TeachingAssistant extends Person {
/**
* The list of all feedback given by a teaching assistant.
*/
@OneToMany
@JoinColumn(name = "teachingAssistant_id")
private List<SectionGrade> sectionGrades;
}