forked from science-ation/science-ation
Add a script to create fake judges for testing with
This commit is contained in:
parent
8ae58b5957
commit
5e858b87fb
145
scripts/judges_fake.php
Normal file
145
scripts/judges_fake.php
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
This file is part of the 'Science Fair In A Box' project
|
||||||
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||||
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation, version 2.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?
|
||||||
|
include "../common.inc.php";
|
||||||
|
|
||||||
|
$numjudges=150;
|
||||||
|
|
||||||
|
mysql_query("TRUNCATE TABLE judges");
|
||||||
|
mysql_query("TRUNCATE TABLE judges_catpref");
|
||||||
|
mysql_query("TRUNCATE TABLE judges_expertise");
|
||||||
|
mysql_query("TRUNCATE TABLE judges_years");
|
||||||
|
mysql_query("TRUNCATE TABLE judges_languages");
|
||||||
|
|
||||||
|
|
||||||
|
function getrand($ar)
|
||||||
|
{
|
||||||
|
return $ar[rand(0,count($ar)-1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
$firstnames=array("James","Bob","Ali","Erin","Julia","Dave","Steve","Bryan","Jane","Elizabeth","Norm","Sue","Eric","Terry","Arthur","Angel","Allison","Jeremy","Jacqueline","Derek","Kristen","Greg","Cheryl","Debbie","Heather","Donald","Linda","George","Patrica","Carmel","Dawn","Scott","Brad","Bruce","Paul","Guillaume");
|
||||||
|
|
||||||
|
$lastnames=array("Grant","Browning","Mehdi","Borque","Temple","Culhane","Sargent","Sing","Belanger","Desjardin","Jones","Smith","Brown","Johnson","Williams","White","Thompson","Baker");
|
||||||
|
|
||||||
|
$domains=array("lightbox.org","microsoft.com","yahoo.com","msn.com","gmail.com","reach.net","slicer.ca","cwsf.ca","sfiab.ca");
|
||||||
|
|
||||||
|
for($x=0;$x<$numjudges;$x++)
|
||||||
|
{
|
||||||
|
$firstname=getrand($firstnames);
|
||||||
|
$lastname=getrand($lastnames);
|
||||||
|
$email=strtolower($firstname."@".getrand($domains));
|
||||||
|
|
||||||
|
|
||||||
|
//set their judging experience (school)
|
||||||
|
$num=rand(0,100);
|
||||||
|
//50% chance they have 0-2 years of experience
|
||||||
|
//30% chance they hvae 3-5 years of experience
|
||||||
|
//15% chance they have 6-9 years of experience
|
||||||
|
//5% chance they have 10-20 years of experience
|
||||||
|
if($num<50) $years_school=rand(0,2);
|
||||||
|
else if($num<80) $years_school=rand(3,5);
|
||||||
|
else if($num<95) $years_school=rand(6,9);
|
||||||
|
else $years_school=rand(10,20);
|
||||||
|
|
||||||
|
//set their judging experience (regional)
|
||||||
|
$num=rand(0,100);
|
||||||
|
//60% chance they have 0-2 years of experience
|
||||||
|
//30% chance they hvae 3-5 years of experience
|
||||||
|
//6% chance they have 6-9 years of experience
|
||||||
|
//4% chance they have 10-15 years of experience
|
||||||
|
if($num<60) $years_regional=rand(0,2);
|
||||||
|
else if($num<90) $years_regional=rand(3,5);
|
||||||
|
else if($num<96) $years_regional=rand(6,9);
|
||||||
|
else $years_regional=rand(10,15);
|
||||||
|
|
||||||
|
//set their judging experience (national)
|
||||||
|
$num=rand(0,100);
|
||||||
|
//70% chance they have 0-2 years of experience
|
||||||
|
//20% chance they hvae 3-5 years of experience
|
||||||
|
//7% chance they have 6-9 years of experience
|
||||||
|
//3% chance they have 10-13 years of experience
|
||||||
|
if($num<70) $years_national=rand(0,2);
|
||||||
|
else if($num<90) $years_national=rand(3,5);
|
||||||
|
else if($num<97) $years_national=rand(6,9);
|
||||||
|
else $years_national=rand(10,13);
|
||||||
|
|
||||||
|
$willing_chair="no";
|
||||||
|
//if more than 10 years combined experience, than there's a 80% chance they'll be a willing chair
|
||||||
|
if($years_national+$years_regional+$years_regional>10)
|
||||||
|
{
|
||||||
|
$num=rand(0,100);
|
||||||
|
if($num<80)
|
||||||
|
$willing_chair="yes";
|
||||||
|
}
|
||||||
|
else if($years_national+$years_regional+$years_regional>6)
|
||||||
|
{
|
||||||
|
//if more than 6 years combined experience, than there's a 40% chance they'll be a willing chair
|
||||||
|
$num=rand(0,100);
|
||||||
|
if($num<40)
|
||||||
|
$willing_chair="yes";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "Creating $firstname $lastname ($email) s=$years_school r=$years_regional n=$years_national wc=$willing_chair <br />\n";
|
||||||
|
|
||||||
|
$q=mysql_query("INSERT INTO judges (firstname,lastname,email,years_school,years_regional,years_national,willing_chair,complete) VALUES ('$firstname','$lastname','$email','$years_school','$years_regional','$years_national','$willing_chair','yes')");
|
||||||
|
$id=mysql_insert_id();
|
||||||
|
|
||||||
|
//for both these, the annealer expects -2 to 2 , but since expertise was done waaaaaay before as 1-5 we'll add it as 1-5 and the annealer will subtract 3
|
||||||
|
//to compensate
|
||||||
|
|
||||||
|
//preference is ranked -2 to 2
|
||||||
|
for($a=1;$a<=3;$a++)
|
||||||
|
{
|
||||||
|
$catrank=rand(-2,2);
|
||||||
|
mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) VALUES ('$id','$a','$catrank','2006')");
|
||||||
|
}
|
||||||
|
|
||||||
|
//expertise is ranked 1-5
|
||||||
|
for($a=1;$a<=6;$a++)
|
||||||
|
{
|
||||||
|
$divrank=rand(1,5);
|
||||||
|
mysql_query("INSERT INTO judges_expertise (judges_id,projectdivisions_id,val,year) VALUES ('$id','$a','$divrank','2006')");
|
||||||
|
}
|
||||||
|
|
||||||
|
//and add the record to the judges_years table so they will be 'active' for this year
|
||||||
|
mysql_query("INSERT INTO judges_years (judges_id,year) VALUES ('$id','2006')");
|
||||||
|
|
||||||
|
//60% chance they only speak english
|
||||||
|
//20% chance they only speak french
|
||||||
|
//20% chance they are bilingual
|
||||||
|
$num=rand(0,100);
|
||||||
|
if($num<60)
|
||||||
|
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('$id','en')");
|
||||||
|
else if($num<80)
|
||||||
|
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('$id','fr')");
|
||||||
|
else {
|
||||||
|
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('$id','en')");
|
||||||
|
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('$id','fr')");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user