- check for the number of tours before checking for tour assignment. This

fixes a bug where tour status always showed complete.
This commit is contained in:
dave 2009-01-29 08:14:16 +00:00
parent 099453e2c3
commit 3d1483975a

View File

@ -258,22 +258,24 @@ function tourStatus($reg_id="")
$sid = $s->id;
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}' ORDER BY rank");
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
$i = mysql_fetch_object($qq);
if($i->rank == 0) {
/* Yes, there is, no matter what, this student's tour
* selection is complete. */
continue;
$n_tours = mysql_num_rows($qq);
if($n_tours > 0) {
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
$i = mysql_fetch_object($qq);
if($i->rank == 0) {
/* Yes, there is, no matter what, this student's tour
* selection is complete. */
continue;
}
}
/* Else, they haven't been assigned a tour, see if they've made
* the appropraite selection(s) */
$n_tours = mysql_num_rows($qq);
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
continue;
}
$ret = "incomplete";
break;
}
return $ret;
}