From b65316c32ebd35443ca80d3c648a5b9a2490cbe5 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 25 Oct 2006 03:19:54 +0000 Subject: [PATCH] Changes to judging scheduler so the process runs smoothly Dont let it start running if its already going Properly handle the text when its done running --- admin/judges_sa.php | 8 +++-- admin/judges_sa_launcher.php | 1 + admin/judges_scheduler_status.php | 37 +++++++++++++++++++--- admin/judges_schedulerconfig.php | 18 ++++++++++- admin/judges_schedulerconfig_check.inc.php | 1 + 5 files changed, 56 insertions(+), 9 deletions(-) diff --git a/admin/judges_sa.php b/admin/judges_sa.php index 8b2f3ce..4efa643 100644 --- a/admin/judges_sa.php +++ b/admin/judges_sa.php @@ -28,7 +28,8 @@ require("anneal.inc.php"); auth_required('admin'); - send_header("Judging teams automatic scheduler"); +/* +send_header("Judging teams automatic scheduler"); echo i18n("The scheduler is running. Depending on the effort it may take @@ -58,6 +59,7 @@ restart the webserver for the change to take effect"); echo "
"; echo "
"; +*/ //function TRACE() { } @@ -769,7 +771,7 @@ echo ""; set_percent(-1); set_status("Done"); -echo happy("Scheduler completed successfully"); +//echo happy("Scheduler completed successfully"); -send_footer(); +//send_footer(); ?> diff --git a/admin/judges_sa_launcher.php b/admin/judges_sa_launcher.php index 057af98..f995bc9 100644 --- a/admin/judges_sa_launcher.php +++ b/admin/judges_sa_launcher.php @@ -1,4 +1,5 @@ /dev/null 2>&1 &"); +usleep(1000000); // 1 second to allow the judges_sa to update the % status to 0% otherwise the status page will think its not running if it gets there too soon header("Location: judges_scheduler_status.php"); ?> diff --git a/admin/judges_scheduler_status.php b/admin/judges_scheduler_status.php index 7aa9ab5..5b7f013 100644 --- a/admin/judges_scheduler_status.php +++ b/admin/judges_scheduler_status.php @@ -65,12 +65,19 @@ var http=getHTTPObject(); function updateStatus() { + document.getElementById('updatestatus').innerHTML="Updating..."; var url="judges_scheduler_status_output.php"; http.open("GET",url,true); http.onreadystatechange=handleResponse; http.send(null); } +function clearUpdatingMessage() +{ + document.getElementById('updatestatus').innerHTML="Waiting..."; + +} + function handleResponse() { try { @@ -79,8 +86,18 @@ function handleResponse() { var obj=http.responseText.split(":"); document.getElementById('schedulerstatus').innerHTML=obj[1]; - document.getElementById('schedulerpercent').innerHTML=obj[0]+"%"; - setTimeout('updateStatus()',5000); + if(obj[0]=="-1") + { + document.getElementById('schedulerpercent').innerHTML="100%"; + document.getElementById('updatestatus').innerHTML="Scheduling Complete"; + } + else + { + document.getElementById('schedulerpercent').innerHTML=obj[0]+"%"; + setTimeout('updateStatus()',5000); + document.getElementById('updatestatus').innerHTML="Updating... Done!"; + setTimeout('clearUpdatingMessage()',500); + } } } catch(e) @@ -94,11 +111,8 @@ function handleResponse() "; echo "
"; echo "".i18n("Judges Scheduler Configuration").""; @@ -109,7 +123,20 @@ else echo ""; echo ""; echo ""; + echo ""; echo "
".i18n("Scheduler status").":
".i18n("Scheduler percent").":
"; + + echo "
"; + echo i18n("When its done running, the following links will be useful"); + echo "
"; +echo "".i18n("Manage Judge Teams").""; +echo "
"; +echo "".i18n("Manage Judge Members").""; +echo "
"; +echo "".i18n("Print/Export Reports").""; +echo "
"; +echo "
"; + P ?> "; + +if($config['judge_scheduler_percent']=="-1") +{ + $ok = 1; echo ""; @@ -108,7 +112,19 @@ if($ok) } -echo ""; +} +else +{ + echo "
"; + echo ""; + echo i18n("The scheduler is currently running"); + echo ""; + echo "
"; + echo "
"; + echo "".i18n("Click here to check the judging scheduler progress").""; + +} + echo "
"; echo "
"; echo "
"; diff --git a/admin/judges_schedulerconfig_check.inc.php b/admin/judges_schedulerconfig_check.inc.php index dd563cc..14efa23 100644 --- a/admin/judges_schedulerconfig_check.inc.php +++ b/admin/judges_schedulerconfig_check.inc.php @@ -126,6 +126,7 @@ function judges_scheduler_check_judges() echo "Current number of registered judges: $currentjudges"; echo "
"; echo "
"; + echo ""; if($currentjudges<$minjudges) { echo error(i18n("You do not have sufficient number of judges based on your parameters"));

Timeslots