forked from science-ation/science-ation
Initial fixes for Judging Scheduler
This commit is contained in:
parent
e418e22435
commit
53d5330862
@ -36,7 +36,7 @@
|
|||||||
// However when I Launch using $WshShell->run($bat_filename,0,false ); for Windows IIS it seems:
|
// However when I Launch using $WshShell->run($bat_filename,0,false ); for Windows IIS it seems:
|
||||||
// All the $_SERVER variables are set as if were a website page so any variable I have tried will cause a bailout
|
// All the $_SERVER variables are set as if were a website page so any variable I have tried will cause a bailout
|
||||||
// THUS.. There is no test I have found to verify this was run from the command line (or in background) for Windows
|
// THUS.. There is no test I have found to verify this was run from the command line (or in background) for Windows
|
||||||
if($_SERVER['SERVER_ADDR']) {
|
if(get_value_from_array($_SERVER, 'SERVER_ADDR')) {
|
||||||
echo "This script must be run from the command line";
|
echo "This script must be run from the command line";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ $round_divisional2 = NULL;
|
|||||||
|
|
||||||
|
|
||||||
function set_status($txt)
|
function set_status($txt)
|
||||||
{
|
{ global $pdo;
|
||||||
TRACE("Status: $txt\n");
|
TRACE("Status: $txt\n");
|
||||||
$stmt = $pdo->prepare("UPDATE config SET val='$txt' WHERE
|
$stmt = $pdo->prepare("UPDATE config SET val='$txt' WHERE
|
||||||
var='judge_scheduler_activity' AND year=0");
|
var='judge_scheduler_activity' AND year=0");
|
||||||
@ -64,7 +64,7 @@ function set_status($txt)
|
|||||||
|
|
||||||
$set_percent_last_percent = -1;
|
$set_percent_last_percent = -1;
|
||||||
function set_percent($n)
|
function set_percent($n)
|
||||||
{
|
{ global $pdo;
|
||||||
global $set_percent_last_percent;
|
global $set_percent_last_percent;
|
||||||
$p = floor($n);
|
$p = floor($n);
|
||||||
if($p == $set_percent_last_percent) return;
|
if($p == $set_percent_last_percent) return;
|
||||||
@ -383,7 +383,7 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
|
|
||||||
TRACE("Loading Languages...\n");
|
TRACE("Loading Languages...\n");
|
||||||
$langr = array();
|
$langr = array();
|
||||||
dddddddddddddddo->prepare("SELECT * FROM languages WHERE active='Y'");
|
$pdo->prepare("SELECT * FROM languages WHERE active='Y'");
|
||||||
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$langr[$r->lang] = $r->langname;
|
$langr[$r->lang] = $r->langname;
|
||||||
TRACE(" {$r->lang} - {$r->langname}\n");
|
TRACE(" {$r->lang} - {$r->langname}\n");
|
||||||
@ -395,7 +395,7 @@ $round = array();
|
|||||||
$q = $pdo->prepare("SELECT * FROM judges_timeslots WHERE round_id='0' AND `year`='{$config['FAIRYEAR']}'");
|
$q = $pdo->prepare("SELECT * FROM judges_timeslots WHERE round_id='0' AND `year`='{$config['FAIRYEAR']}'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
/* Loads judges_timeslots.id, .starttime, .endtime, .date, .name */
|
/* Loads judges_timeslots.id, .starttime, .endtime, .date, .name */
|
||||||
while($r = $q=>fetch(PDO::FETCH_ASSOC)) {
|
while($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
TRACE(" id:{$r['id']} type:{$r['type']} name:{$r['name']}\n");
|
TRACE(" id:{$r['id']} type:{$r['type']} name:{$r['name']}\n");
|
||||||
|
|
||||||
$qq = $pdo->prepare("SELECT * FROM judges_timeslots WHERE round_id='{$r['id']}'");
|
$qq = $pdo->prepare("SELECT * FROM judges_timeslots WHERE round_id='{$r['id']}'");
|
||||||
@ -470,7 +470,7 @@ foreach($keys as $jdiv_id) {
|
|||||||
|
|
||||||
/* Clean out the judging teams that were autocreated in a previous run */
|
/* Clean out the judging teams that were autocreated in a previous run */
|
||||||
TRACE("Deleting autocreated divisional and special award judging teams:");
|
TRACE("Deleting autocreated divisional and special award judging teams:");
|
||||||
$q = pdo->prepare("SELECT * FROM judges_teams WHERE autocreate_type_id=1 AND year={$config['FAIRYEAR']}");
|
$q = $pdo->prepare("SELECT * FROM judges_teams WHERE autocreate_type_id=1 AND year={$config['FAIRYEAR']}");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
while($r = $q->fetch(PDO::FETCH_OBJ)) {
|
while($r = $q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$id = $r->id;
|
$id = $r->id;
|
||||||
@ -563,7 +563,7 @@ foreach($judges as &$j) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$q->execute();
|
$q->execute();
|
||||||
while($r = $q=>fetch(PDO::FETCH_ASSOC)) {
|
while($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$j['availability'][] = $r;
|
$j['availability'][] = $r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -621,7 +621,7 @@ if(count($judges)==0) {
|
|||||||
$q = $pdo->prepare("SELECT * FROM judges_teams WHERE year={$config['FAIRYEAR']}");
|
$q = $pdo->prepare("SELECT * FROM judges_teams WHERE year={$config['FAIRYEAR']}");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
$used_judges_teams_numbers = array();
|
$used_judges_teams_numbers = array();
|
||||||
while($i = $q=>fetch(PDO::FETCH_ASSOC)) {
|
while($i = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$used_judges_teams_numbers[] = $i['num'];
|
$used_judges_teams_numbers[] = $i['num'];
|
||||||
}
|
}
|
||||||
echo "The following judge team numbers are already used: \n";
|
echo "The following judge team numbers are already used: \n";
|
||||||
@ -1292,7 +1292,7 @@ if($config['scheduler_enable_sa_scheduling'] == 'yes') {
|
|||||||
/* Do timeslot and project timeslot assignment */
|
/* Do timeslot and project timeslot assignment */
|
||||||
$stmt = $pdo->prepare("INSERT INTO judges_teams_timeslots_link
|
$stmt = $pdo->prepare("INSERT INTO judges_teams_timeslots_link
|
||||||
(judges_teams_id,judges_timeslots_id,year)
|
(judges_teams_id,judges_timeslots_id,year)
|
||||||
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '{$config['FAIRYEAR']}')")
|
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '{$config['FAIRYEAR']}')");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
if(get_value_from_array($_GET,'action')) $action=get_value_from_array($_GET,'action');
|
if(get_value_from_array($_GET,'action')) $action=get_value_from_array($_GET,'action');
|
||||||
if(get_value_from_array($_POST,'action')) $action=get_value_from_array($_POST,'action');
|
if(get_value_from_array($_POST,'action')) $action=get_value_from_array($_POST,'action');
|
||||||
|
|
||||||
if($action == "delete" && get_value_from_array($_GET, 'delete'))
|
if(get_value_or_default($action) == "delete" && get_value_from_array($_GET, 'delete'))
|
||||||
{
|
{
|
||||||
//ALSO DELETE: team members, timeslots, projects, awards
|
//ALSO DELETE: team members, timeslots, projects, awards
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
$stmt->execute();message_push(happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team")));
|
$stmt->execute();message_push(happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="deletealldivisional")
|
if(get_value_or_default($action)=="deletealldivisional")
|
||||||
{
|
{
|
||||||
$q2=$pdo->prepare("SELECT *
|
$q2=$pdo->prepare("SELECT *
|
||||||
FROM
|
FROM
|
||||||
@ -81,7 +81,7 @@
|
|||||||
message_push(error(i18n("There were no auto-created divisional teams to delete")));
|
message_push(error(i18n("There were no auto-created divisional teams to delete")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="deleteall")
|
if(get_value_or_default($action)=="deleteall")
|
||||||
{
|
{
|
||||||
$q2=$pdo->prepare("SELECT *
|
$q2=$pdo->prepare("SELECT *
|
||||||
FROM judges_teams
|
FROM judges_teams
|
||||||
@ -112,7 +112,7 @@
|
|||||||
message_push(error(i18n("There were no teams to delete")));
|
message_push(error(i18n("There were no teams to delete")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($action=="save" || $action=="assign") && $edit)
|
if((get_value_or_default($action)=="save" || $action=="assign") && $edit)
|
||||||
{
|
{
|
||||||
//if we're updating or assigning, it doesnt matter, lets do the same thing (save record, add award
|
//if we're updating or assigning, it doesnt matter, lets do the same thing (save record, add award
|
||||||
//but when we're done, if we're "assign" then go back to edit that team
|
//but when we're done, if we're "assign" then go back to edit that team
|
||||||
@ -189,7 +189,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="unassign")
|
if(get_value_or_default($action)=="unassign")
|
||||||
{
|
{
|
||||||
$stmt = $pdo->prepare("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$edit' AND award_awards_id='".$_GET['unassign']."' AND year='".$config['FAIRYEAR']."'");
|
$stmt = $pdo->prepare("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$edit' AND award_awards_id='".$_GET['unassign']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@ -198,7 +198,7 @@
|
|||||||
$action="edit";
|
$action="edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="createall")
|
if(get_value_or_default($action)=="createall")
|
||||||
{
|
{
|
||||||
//first make sure we dont have any non-divisional award teams (dont want people hitting refresh and adding all the teams twice
|
//first make sure we dont have any non-divisional award teams (dont want people hitting refresh and adding all the teams twice
|
||||||
$q=$pdo->prepare("SELECT COUNT(*) AS c FROM judges_teams WHERE autocreate_type_id!='1' AND year='".$config['FAIRYEAR']."'");
|
$q=$pdo->prepare("SELECT COUNT(*) AS c FROM judges_teams WHERE autocreate_type_id!='1' AND year='".$config['FAIRYEAR']."'");
|
||||||
@ -259,7 +259,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="add" && $_GET['num'])
|
if(get_value_or_default($action)=="add" && $_GET['num'])
|
||||||
{
|
{
|
||||||
$stmt = $pdo->prepare("INSERT INTO judges_teams(num,year) VALUES ('".$_GET['num']."','".$config['FAIRYEAR']."')");
|
$stmt = $pdo->prepare("INSERT INTO judges_teams(num,year) VALUES ('".$_GET['num']."','".$config['FAIRYEAR']."')");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@ -268,7 +268,7 @@
|
|||||||
$action="edit";
|
$action="edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=="edit" && $edit)
|
if(get_value_or_default($action)=="edit" && $edit)
|
||||||
{
|
{
|
||||||
send_header("Edit Judging Team",
|
send_header("Edit Judging Team",
|
||||||
array('Committee Main' => 'committee_main.php',
|
array('Committee Main' => 'committee_main.php',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user