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
This commit is contained in:
james 2006-10-25 03:19:54 +00:00
parent 2bb5c2e2a4
commit b65316c32e
5 changed files with 56 additions and 9 deletions

View File

@ -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 "<br />";
echo "<br />";
*/
//function TRACE() { }
@ -769,7 +771,7 @@ echo "</pre>";
set_percent(-1);
set_status("Done");
echo happy("Scheduler completed successfully");
//echo happy("Scheduler completed successfully");
send_footer();
//send_footer();
?>

View File

@ -1,4 +1,5 @@
<?
exec("php judges_sa.php >/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");
?>

View File

@ -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()
<?
if($config['judge_scheduler_percent']=="-1")
//|| $config['judge_scheduler_percent']=="0")
{
echo i18n("The judge scheduler is not currently running");
echo $config['judge_scheduler_percent'];
echo $config['judge_scheduler_activity'];
echo "<br />";
echo "<br />";
echo "<a href=\"judges_schedulerconfig.php\">".i18n("Judges Scheduler Configuration")."</a>";
@ -109,7 +123,20 @@ else
echo "<table>";
echo "<tr><td>".i18n("Scheduler status").":</td><td><div id=\"schedulerstatus\" style=\"font-weight: bold;\"></div></td></tr>";
echo "<tr><td>".i18n("Scheduler percent").":</td><td><div id=\"schedulerpercent\" style=\"font-weight: bold;\"></div></td></tr>";
echo "<tr><td align=\"center\" colspan=\"2\"><div id=\"updatestatus\" style=\"font-weight: bold; text-align: center;\"></div></td></tr>";
echo "</table>";
echo "<br />";
echo i18n("When its done running, the following links will be useful");
echo "<br />";
echo "<a href=\"judges_teams.php\">".i18n("Manage Judge Teams")."</a>";
echo "<br />";
echo "<a href=\"judges_teams_members.php\">".i18n("Manage Judge Members")."</a>";
echo "<br />";
echo "<a href=\"reports.php\">".i18n("Print/Export Reports")."</a>";
echo "<br />";
echo "<br />";
P
?>
<script type="text/javascript">updateStatus()</script>
<?

View File

@ -45,6 +45,10 @@ ogram; see the file COPYING. If not, write to
config_editor("Judge Scheduler", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
echo "<hr />";
if($config['judge_scheduler_percent']=="-1")
{
$ok = 1;
echo "<table class='headertable'><tr><td><h3>Timeslots</h3></td>";
@ -108,7 +112,19 @@ if($ok)
}
echo "</b>";
}
else
{
echo "<br />";
echo "<b>";
echo i18n("The scheduler is currently running");
echo "</b>";
echo "<br />";
echo "<br />";
echo "<a href=\"judges_scheduler_status.php\">".i18n("Click here to check the judging scheduler progress")."</a>";
}
echo "<br />";
echo "<br />";
echo "<br />";

View File

@ -126,6 +126,7 @@ function judges_scheduler_check_judges()
echo "Current number of registered judges: $currentjudges";
echo "<br />";
echo "<br />";
echo "</b>";
if($currentjudges<$minjudges)
{
echo error(i18n("You do not have sufficient number of judges based on your parameters"));