function Student::get_best_grade_for_course

7.x Student.php Student::get_best_grade_for_course(Course $course)
6.x Student.php Student::get_best_grade_for_course(Course $course)

This function will find the best grade the student made on a particular course, and return it.

It will return FALSE if the student never took the course.

Parameters

unknown_type $course:

File

classes/Student.php, line 829

Class

Student

Code

function get_best_grade_for_course(Course $course) {

  $rtn = FALSE;

  // To help speed things up, let's see if we have cached this course already.
  if (isset($GLOBALS ['fp_temp_cache_' . $this->student_id][$this->school_id]['best_grade_for_course'][$course->course_id])) {
    return $GLOBALS ['fp_temp_cache_' . $this->student_id][$this->school_id]['best_grade_for_course'][$course->course_id];
  }

  $c = $this->list_courses_taken->find_best_grade_match($course);

  if ($c) {
    $rtn = $c->grade;
  }

  // Set into our cache
  $GLOBALS ['fp_temp_cache_' . $this->student_id][$this->school_id]['best_grade_for_course'][$course->course_id] = $rtn;


  return $rtn;

}