function CourseList::find_best_match

7.x CourseList.php CourseList::find_best_match(Course $course_c, $min_grade = "", $bool_mark_repeats_exclude = false, $degree_id = 0, $bool_skip_already_assigned_to_degree = TRUE, $bool_skip_subs = FALSE, $group_id = 0)
6.x CourseList.php CourseList::find_best_match(Course $course_c, $min_grade = "", $bool_mark_repeats_exclude = false, $degree_id = 0, $bool_skip_already_assigned_to_degree = TRUE, $bool_skip_subs = FALSE, $group_id = 0)

Find the "best" match for this course, based on what the university considers a best match. This largely has to do with repeats. If the student has more than one credit, what is the "best" match?

For example, at ULM we consider the best match to be the most recent that meets the minimum requirements. Other schools might simply take the best grade.

Return value

Course

File

classes/CourseList.php, line 1706

Class

CourseList

Code

function find_best_match(Course $course_c, $min_grade = "", $bool_mark_repeats_exclude = false, $degree_id = 0, $bool_skip_already_assigned_to_degree = TRUE, $bool_skip_subs = FALSE, $group_id = 0) 
 {
  $rtn = FALSE;

  $school_id = $course_c->school_id;

  // We will look at the course_repeat_policy to determine which type of search to do on this list.
  $course_repeat_policy = variable_get_for_school("course_repeat_policy", "most_recent_exclude_previous", $school_id);

  if ($course_repeat_policy == "best_grade_exclude_others") {
    // Search for best grade, exclude other attempts.
    $rtn = $this->find_best_grade_match($course_c, $min_grade, TRUE, $degree_id, $bool_skip_already_assigned_to_degree, $bool_skip_subs, $group_id);
  }
  else {
    // Search for most recent first, possibly mark previous as excluded.      
    $rtn = $this->find_most_recent_match($course_c, $min_grade, $bool_mark_repeats_exclude, $degree_id, $bool_skip_already_assigned_to_degree, $bool_skip_subs, $group_id);
  }

  return $rtn;
}