Fix for quiz pass rate hard coded

  1. /**
  2.  * Check a user/quiz combo to see if the user passed the given quiz.
  3.  * A quiz is keyed by nid/vid, so you need both.
  4.  * This will return TRUE if the user has passed the quiz at least once, and
  5.  * false otherwise. Note that a FALSE may simply indicate that the user has not
  6.  * taken the quiz.
  7.  * @param $uid
  8.  *  The user ID.
  9.  * @param $nid
  10.  *  The node ID.
  11.  * @param $vid
  12.  *  The version ID.
  13.  */
  14. function quiz_is_passed($uid, $nid, $vid) {
  15.   $passed = db_result(db_query("SELECT COUNT(result_id) AS passed_count
  16.    FROM {quiz_node_results} qnrs
  17.    INNER JOIN {quiz_node_properties} USING (vid, nid)
  18.    WHERE qnrs.vid = %d AND qnrs.nid = %d AND qnrs.uid =%d AND score >= pass_rate",
  19.     $vid, $nid, $uid
  20.   ));
  21.  
  22.   // Force into boolean context
  23.   return ($passed !== FALSE && $passed > 0);
  24. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.