| 1 | package edu.ucsb.cs156.courses.models; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.courses.documents.ConvertedSection; | |
| 4 | import lombok.AllArgsConstructor; | |
| 5 | import lombok.Builder; | |
| 6 | import lombok.Data; | |
| 7 | import lombok.NoArgsConstructor; | |
| 8 | ||
| 9 | @Builder | |
| 10 | @Data | |
| 11 | @AllArgsConstructor | |
| 12 | @NoArgsConstructor | |
| 13 | public class SectionCSVLine { | |
| 14 | ||
| 15 | private String quarter; | |
| 16 | private String courseId; | |
| 17 | private String section; | |
| 18 | private String instructor; | |
| 19 | private String enrolled; | |
| 20 | private String maxEnroll; | |
| 21 | private String status; | |
| 22 | private String ges; | |
| 23 | ||
| 24 | public static String intToStringWithDefault(Integer i) { | |
| 25 |
2
1. intToStringWithDefault : replaced return value with "" for edu/ucsb/cs156/courses/models/SectionCSVLine::intToStringWithDefault → KILLED 2. intToStringWithDefault : negated conditional → KILLED |
return i == null ? "0" : i.toString(); |
| 26 | } | |
| 27 | ||
| 28 | public static SectionCSVLine toSectionCSVLine(ConvertedSection cs) { | |
| 29 |
1
1. toSectionCSVLine : replaced return value with null for edu/ucsb/cs156/courses/models/SectionCSVLine::toSectionCSVLine → KILLED |
return SectionCSVLine.builder() |
| 30 | .quarter(cs.getCourseInfo().getQuarter()) | |
| 31 | .courseId(cs.getCourseInfo().getCourseId()) | |
| 32 | .section(cs.getSection().getSection()) | |
| 33 | .enrolled(intToStringWithDefault(cs.getSection().getEnrolledTotal())) | |
| 34 | .maxEnroll(intToStringWithDefault(cs.getSection().getMaxEnroll())) | |
| 35 | .instructor(cs.getSection().instructorList()) | |
| 36 | .status(cs.getSection().status()) | |
| 37 | .ges(cs.getCourseInfo().ges()) | |
| 38 | .build(); | |
| 39 | } | |
| 40 | } | |
Mutations | ||
| 25 |
1.1 2.2 |
|
| 29 |
1.1 |