1 | package edu.ucsb.cs156.courses.entities; | |
2 | ||
3 | import javax.persistence.Entity; | |
4 | import javax.persistence.GenerationType; | |
5 | import javax.persistence.Id; | |
6 | import javax.persistence.Table; | |
7 | import javax.persistence.UniqueConstraint; | |
8 | import javax.persistence.GeneratedValue; | |
9 | ||
10 | import lombok.Builder; | |
11 | import lombok.Data; | |
12 | import lombok.NoArgsConstructor; | |
13 | import lombok.AllArgsConstructor; | |
14 | import lombok.Builder; | |
15 | ||
16 | /** | |
17 | * GradeHistory - Entity for grade history data. Each object represents one | |
18 | * row from the CSV files located in this repository: | |
19 | * <a href="https://github.com/ucsb-cs156/UCSB_Grades">https://github.com/ucsb-cs156/UCSB_Grades</a> | |
20 | * | |
21 | * There is a unique constraint on the combination of | |
22 | * quarter, subjectArea, course, instructor, and grade, since we do not want | |
23 | * duplicate rows of data for the same course. | |
24 | */ | |
25 | ||
26 | @Data | |
27 | @Builder | |
28 | @AllArgsConstructor | |
29 | @NoArgsConstructor | |
30 | @Entity(name = "gradehistory") | |
31 | @Table(uniqueConstraints = { @UniqueConstraint(name = "UniqueGradeHistory", columnNames = { "yyyyq", "course","instructor","grade" }) }) | |
32 | public class GradeHistory { | |
33 | @Id | |
34 | @GeneratedValue(strategy = GenerationType.IDENTITY) | |
35 | private Long id; | |
36 | private String yyyyq; | |
37 | private String course; | |
38 | private String instructor; | |
39 | private String grade; | |
40 | private int count; | |
41 | | |
42 | public String getSubjectArea() { | |
43 |
1
1. getSubjectArea : negated conditional → KILLED |
if (course==null) |
44 |
1
1. getSubjectArea : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED |
return null; |
45 |
1
1. getSubjectArea : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getSubjectArea → KILLED |
return course.substring(0, 8).trim(); |
46 | } | |
47 | public String getCourseNum() { | |
48 |
1
1. getCourseNum : negated conditional → KILLED |
if (course==null) |
49 |
1
1. getCourseNum : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED |
return null; |
50 |
1
1. getCourseNum : replaced return value with "" for edu/ucsb/cs156/courses/entities/GradeHistory::getCourseNum → KILLED |
return course.substring(8).trim(); |
51 | } | |
52 | } | |
Mutations | ||
43 |
1.1 |
|
44 |
1.1 |
|
45 |
1.1 |
|
48 |
1.1 |
|
49 |
1.1 |
|
50 |
1.1 |