Skip to content

Commit

Permalink
GRAD2-2325: Changes to add a studentGrade field in snapshot response.
Browse files Browse the repository at this point in the history
GRAD2-2325: Changes to add a studentGrade field in snapshot response.
  • Loading branch information
infstar committed Oct 20, 2023
1 parent 28dc682 commit f987366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ public class SnapshotResponse {
private BigDecimal gpa;
private String honourFlag;
private String schoolOfRecord;
private String studentGrade;

public SnapshotResponse(String pen, String graduatedDate, BigDecimal gpa, String honourFlag, String schoolOfRecord) {
public SnapshotResponse(String pen, String graduatedDate, BigDecimal gpa, String honourFlag, String schoolOfRecord, String studentGrade) {
this.pen = pen;
this.graduatedDate = graduatedDate;
this.gpa = gpa;
this.honourFlag = honourFlag;
this.schoolOfRecord = schoolOfRecord;
this.studentGrade = studentGrade;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@
@Repository
public interface SnapshotRepository extends JpaRepository<SnapshotEntity, SnapshotID> {

@Query(value="select s.mincode as schoolOfRecord from (\n" +
" select mincode, count(*) from SNAPSHOT\n" +
" where grad_year = :gradYear\n" +
" group by mincode\n" +
" order by 2 desc ) s", nativeQuery=true)
@Query(value="select distinct trim(s.mincode) as schoolOfRecord\n" +
"from snapshot s\n" +
"where s.grad_year = :gradYear", nativeQuery=true)
List<String> getSchools(@Param("gradYear") Integer gradYear);

@Query(value="select new ca.bc.gov.educ.api.trax.model.dto.SnapshotResponse(trim(s.pen), trim(s.graduatedDate), s.gpa, trim(s.honourFlag), trim(s.schoolOfRecord))\n" +
@Query(value="select new ca.bc.gov.educ.api.trax.model.dto.SnapshotResponse(trim(s.pen), trim(s.graduatedDate), s.gpa, trim(s.honourFlag), trim(s.schoolOfRecord), trim(s.studGrade))\n" +
"from SnapshotEntity s\n" +
"where s.gradYear = :gradYear")
List<SnapshotResponse> getStudentsByGradYear(@Param("gradYear") Integer gradYear);

@Query(value="select new ca.bc.gov.educ.api.trax.model.dto.SnapshotResponse(trim(s.pen), trim(s.graduatedDate), s.gpa, trim(s.honourFlag), trim(s.schoolOfRecord))\n" +
@Query(value="select new ca.bc.gov.educ.api.trax.model.dto.SnapshotResponse(trim(s.pen), trim(s.graduatedDate), s.gpa, trim(s.honourFlag), trim(s.schoolOfRecord), trim(s.studGrade))\n" +
"from SnapshotEntity s\n" +
"where s.gradYear = :gradYear\n" +
"and s.schoolOfRecord = :schoolOfRecord")
Expand Down

0 comments on commit f987366

Please sign in to comment.