function _CourseList::find_best_match

4.x _CourseList.php _CourseList::find_best_match(Course $course_c, $min_grade = "D", $bool_mark_repeats_exclude = false)
5.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 1670

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;



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

  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;
}