function _Student::get_best_grade_for_course

5.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 834

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]['best_grade_for_course'][$course->course_id])) {
    return $GLOBALS ['fp_temp_cache_' . $this->student_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]['best_grade_for_course'][$course->course_id] = $rtn;


  return $rtn;

}