| 1 | package edu.ucsb.cs156.courses.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.courses.entities.EnrollmentDataPoint; | |
| 4 | import edu.ucsb.cs156.courses.repositories.EnrollmentDataPointRepository; | |
| 5 | import edu.ucsb.cs156.courses.utilities.CourseUtilities; | |
| 6 | import io.swagger.v3.oas.annotations.Operation; | |
| 7 | import io.swagger.v3.oas.annotations.Parameter; | |
| 8 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | import lombok.extern.slf4j.Slf4j; | |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | import org.springframework.web.bind.annotation.GetMapping; | |
| 12 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | import org.springframework.web.bind.annotation.RestController; | |
| 15 | ||
| 16 | @Slf4j | |
| 17 | @Tag(name = "API for enrollment history data") | |
| 18 | @RequestMapping("/api/enrollmenthistory") | |
| 19 | @RestController | |
| 20 | public class EnrollmentHistoryController extends ApiController { | |
| 21 | ||
| 22 | @Autowired EnrollmentDataPointRepository enrollmentDataPointRepository; | |
| 23 | ||
| 24 | @Operation(summary = "Get enrollment history for a course across all quarters") | |
| 25 | @GetMapping(value = "/search", produces = "application/json") | |
| 26 | public Iterable<EnrollmentDataPoint> enrollmentHistoryBySubjectAreaAndCourseNumber( | |
| 27 | @Parameter( | |
| 28 | name = "subjectArea", | |
| 29 | description = "Subject area of UCSB course", | |
| 30 | example = "CMPSC", | |
| 31 | required = true) | |
| 32 | @RequestParam | |
| 33 | String subjectArea, | |
| 34 | @Parameter( | |
| 35 | name = "courseNumber", | |
| 36 | description = "Course number within a subject area", | |
| 37 | example = "156", | |
| 38 | required = true) | |
| 39 | @RequestParam | |
| 40 | String courseNumber) { | |
| 41 | String courseId = CourseUtilities.makeFormattedCourseId(subjectArea, courseNumber); | |
| 42 |
1
1. enrollmentHistoryBySubjectAreaAndCourseNumber : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/controllers/EnrollmentHistoryController::enrollmentHistoryBySubjectAreaAndCourseNumber → KILLED |
return enrollmentDataPointRepository.findByCourseIdStartingWith(courseId); |
| 43 | } | |
| 44 | } | |
Mutations | ||
| 42 |
1.1 |