my$query="select count(bug_id) from bugs,profiles where bugs.bug_status='NEW' and userid=assigned_to and userid='$person' and target_milestone='' and bug_severity!='enhancement' and status_whiteboard='' and (product='Browser' or product='MailNews')";
if($FORM{'product'}ne"-All-"){
$query.="and bugs.product='$FORM{'product'}'";
}
SendSQL($query);
my$bugcount=FetchSQLData();
$bugsperperson{$person}=$bugcount;
$bugtotal+=$bugcount;
}
# sort people by the number of bugs they have assigned to this milestone
@people=sortbybugs@people;
my$totalpeople=@people;
if($totalpeople>20){
splice@people,0,$totalpeople-20;
}
print"<TABLE>\n";
print"<TR><TD COLSPAN=2>\n";
print"$totalpeople engineers have $bugtotal untouched new bugs.\n";
if($totalpeople>20){
print"These are the 20 most doomed.";
}
print"</TD></TR>\n";
while(@people){
$person=pop@people;
print"<TR><TD>\n";
SendSQL("select login_name from profiles where userid=$person");