When adding a winner for a special award, only show choices of those who nominated themselves for that award (instead of all eligible projects)

This commit is contained in:
james 2005-05-12 19:06:12 +00:00
parent 570d7714dc
commit 32e36648b4
2 changed files with 47 additions and 4 deletions

@ -73,11 +73,49 @@ function addclicked()
if($_POST['award'])
{
//link up the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('".$_POST['award']."','$edit','".$config['FAIRYEAR']."')");
echo happy(i18n("Award assigned to team"));
//we can only have 1 special award assigned to any given team so we'll be able to properly
//manage the projects that we assign to the team. If there was more than one special award
//the judges wouldnt know which projects to judge for which award. This doesnt apply for divisions
//because the category/division is obvious based on project numbesr. A divisional judge team could easily
//be assigned to do all of Comp Sci - Junior, Intermediate and Senior without any problems.
$q=mysql_query("SELECT award_types.type FROM award_awards, award_types WHERE award_awards.award_types_id=award_types.id AND award_awards.id='".$_POST['award']."'");
$aw=mysql_fetch_object($q);
$addaward=true;
if($aw->type=="Special")
{
$q=mysql_query("SELECT COUNT(*) AS num FROM
judges_teams_awards_link,
award_awards,
award_types
WHERE
judges_teams_awards_link.judges_teams_id='$edit'
AND judges_teams_awards_link.award_awards_id=award_awards.id
AND award_awards.award_types_id=award_types.id
AND award_types.type='Special'
");
$r=mysql_fetch_object($q);
echo "special awards: $r->num";
if($r->num)
{
$addaward=false;
echo error(i18n("Sorry, only one Special Award can be assigned to a judging team"));
}
else
{
$addaward=true;
}
}
if($addaward)
{
//link up the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('".$_POST['award']."','$edit','".$config['FAIRYEAR']."')");
echo happy(i18n("Award assigned to team"));
}
}
if($action=="assign")
$action="edit";
else if($action=="save")

@ -106,7 +106,12 @@ if($action=="edit" && $edit)
echo "<br />";
//get the projets that are eligible for the award, given the award ID ($r->id)
$projects=getProjectsEligibleForAward($r->id);
if($r->type=="Special")
{
$projects=getProjectsNominatedForSpecialAward($r->id);
}
else
$projects=getProjectsEligibleForAward($r->id);
$winq=mysql_query("SELECT
winners.projects_id