From a169e422e676773d02e4a0defcff8691a4f49125 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 12 Aug 2006 18:05:38 +0000 Subject: [PATCH] Add support to choose what status a project must have to be used by the judge scheduler. Allows for any of open, payment pending or complete projects to be allowed. --- admin/judges.inc.php | 15 +++++++++++++++ admin/judges_sa.php | 8 +++++--- admin/judges_schedulerconfig_check.inc.php | 8 +++++--- db/db.code.version.txt | 2 +- db/db.update.22.sql | 2 ++ 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 db/db.update.22.sql diff --git a/admin/judges.inc.php b/admin/judges.inc.php index 3509def..102a7dd 100644 --- a/admin/judges.inc.php +++ b/admin/judges.inc.php @@ -178,4 +178,19 @@ function getJudgingTeam($teamid) } +function getJudgingEligibilityCode() { + global $config; + switch($config['project_status']) { + case 'open' : + return " AND registrations.status != 'open' "; + break; + case 'payment_pending' : + return " AND registrations.status IN ('paymentpending', 'complete')"; + break; + case 'complete' : + return " AND registrations.status = 'complete'"; + break; + } +} + ?> diff --git a/admin/judges_sa.php b/admin/judges_sa.php index 55185d9..6474bb6 100644 --- a/admin/judges_sa.php +++ b/admin/judges_sa.php @@ -249,11 +249,13 @@ for($k=0; $k 0) TRACE("\t- "); TRACE($cat[$d['cat']]." ".$div[$d['div']]." - ".$langr[$d['lang']]); - $qp = mysql_query("SELECT * FROM projects WHERE ". - " year='".$config['FAIRYEAR']."' AND ". + $qp = mysql_query("SELECT projects.* FROM projects, registrations WHERE ". + " projects.year='".$config['FAIRYEAR']."' AND ". " projectdivisions_id='{$d['div']}' AND ". " projectcategories_id='{$d['cat']}' AND ". - " language='{$d['lang']}' " + " language='{$d['lang']}' AND " . + " registrations.id = projects.registrations_id " . + getJudgingEligibilityCode() ); $count = 0; while($rp = mysql_fetch_object($qp)) { diff --git a/admin/judges_schedulerconfig_check.inc.php b/admin/judges_schedulerconfig_check.inc.php index 540ff4d..dd563cc 100644 --- a/admin/judges_schedulerconfig_check.inc.php +++ b/admin/judges_schedulerconfig_check.inc.php @@ -79,11 +79,13 @@ function judges_scheduler_check_judges() $c = $r->projectcategories_id; $l = $r->lang; - $qp = mysql_query("SELECT COUNT(id) as cnt FROM projects WHERE ". - " year='".$config['FAIRYEAR']."' AND ". + $qp = mysql_query("SELECT COUNT(projects.id) as cnt FROM projects, registrations WHERE ". + " projects.year='".$config['FAIRYEAR']."' AND ". " projectdivisions_id='$d' AND ". " projectcategories_id='$c' AND ". - " language='$l' " + " language='$l' AND " . + " registrations.id = projects.registrations_id " . + getJudgingEligibilityCode() ); $qr = mysql_fetch_object($qp); diff --git a/db/db.code.version.txt b/db/db.code.version.txt index aabe6ec..2bd5a0a 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -21 +22 diff --git a/db/db.update.22.sql b/db/db.update.22.sql new file mode 100644 index 0000000..1129d3a --- /dev/null +++ b/db/db.update.22.sql @@ -0,0 +1,2 @@ +INSERT INTO `config` (`var`, `val`, `description`, `category`, `year`, `ord`) VALUES +('project_status', 'payment_pending', 'The status a project must have have to be considered eligible for judge scheduling. Must be one of "open", "payment_pending" or "complete".', 'Judge Scheduler', -1, 600);