Fix complete/incomplete detection for tour choices

- Incomplete if any student in the project hasn't selected the min number of tours.
This commit is contained in:
dave 2007-01-10 05:16:58 +00:00
parent a386788300
commit b022cb5978

View File

@ -243,15 +243,24 @@ function tourStatus($reg_id="")
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
//grab all of their tour prefs
$q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='$rid' and year='{$config['FAIRYEAR']}'");
/* Get the students for this project */
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$num_found = mysql_num_rows($q);
$n_tours = mysql_num_rows($q);
$ret = "complete";
while($s=mysql_fetch_object($q)) {
//grab all of their tour prefs
$sid = $s->id;
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}'");
$n_tours = mysql_num_rows($qq);
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
return "complete";
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
continue;
}
$ret = "incomplete";
}
return "incomplete";
return $ret;
}