forked from science-ation/science-ation
automatically assign a new team captain if the current team captain is removed from the team
This commit is contained in:
parent
3f471bde41
commit
ab424f244f
@ -147,9 +147,33 @@ function switchjudgeinfo()
|
||||
mysql_query("DELETE FROM judges_teams WHERE year='".$config['FAIRYEAR']."' AND id='".$_POST['team_id']."'");
|
||||
echo notice(i18n("Removed empty team #%1 (%2)",array($_POST['team_num'],$_POST['team_name'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
//make sure the team still has a captain!
|
||||
//FIXME: this might best come from the "i am willing to be a team captain" question under the judges profile
|
||||
$gotcaptain=false;
|
||||
$first=true;
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($first)
|
||||
{
|
||||
$firstjudge=$r->judges_id;
|
||||
$first=false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($r->captain=="yes")
|
||||
{
|
||||
$gotcaptain=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$gotcaptain)
|
||||
{
|
||||
//make the first judge the captain
|
||||
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_POST['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'");
|
||||
echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['action']=="saveteamnames")
|
||||
|
Loading…
x
Reference in New Issue
Block a user