Skip to content

Instantly share code, notes, and snippets.

@lennyferguson
Last active April 30, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennyferguson/e2f5e9a7e0ca8759209d3110c3c2f58e to your computer and use it in GitHub Desktop.
Save lennyferguson/e2f5e9a7e0ca8759209d3110c3c2f58e to your computer and use it in GitHub Desktop.
/**
* QaUser type that encapsulates information displayed for StudentSummary
* which involves enrolled classes, and grades
*/
public class SummaryStudent extends QaUser {
private List<StudentGrade> studentGrades;
private List<StudentClass> studentClasses;
/**
* Get a List of Grades by class for the specified term for the source Student
* @param argTerm The Term to collect the grades from
* @return A List of StudentGrade objects containing class and grade information
*/
public List<StudentGrade> getStudentGrades(final String argTerm) {
if(studentGrades == null) {
studentGrades = heTemplate.query(
SELECT_STUDENT_CLASSES,
(stdnt_enrl, r1) -> heTemplate.queryForObject(
SELECT_CLASS_INFO,
// Map each row to a StudentClass
(class_tbl, r2) -> StudentGrade.fromQuery(stdnt_enrl, class_tbl, StudentManager.this::mapCareerCode),
// Query for each class by 'CLASS_NBR' and term
stdnt_enrl.getString("class"),
stdnt_enrl.getString("term")),
this.getEmplid());
}
return studentGrades.stream()
.filter(clz -> clz.term.equals(argTerm))
.collect(Collectors.toList());
}
/**
* Get a List of Grades by class for the currently selected term.
* Note: Default currently selected term is the term specified by the aft.term property
* @return A List of StudentGrade objects containing class and grade information
*/
public List<StudentGrade> getStudentGrades() {
return getStudentGrades(getSelectedTerm());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment