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