function student_priority_get_academic_priority_value

6.x student_priority.module student_priority_get_academic_priority_value($student_id, $recalculate_if_older_than = 86400)

Queries for the academic priority value, and if its older than the set number of seconds, we will re-calculate for this student. Set to zero to force it to recalculate every time.

1 call to student_priority_get_academic_priority_value()

File

modules/student_priority/student_priority.module, line 233

Code

function student_priority_get_academic_priority_value($student_id, $recalculate_if_older_than = 86400) {

  $check_ts = time() - $recalculate_if_older_than;



  $val = db_result(db_query('SELECT priority_value FROM student_priority WHERE student_id = ? AND updated > ?', array($student_id, $check_ts)));

  if (!$val) {
    // Recalculate!
    //fpm('recalculating');
    $calcs = student_priority_get_calculations_for_student($student_id, TRUE);
    $rtn = $calcs ['percent'];

    return $rtn;
  }

  return $val;

}