From 5e858b87fb28cdaa39a88cba5fe23e9a5f77ff66 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 3 Jan 2006 01:50:54 +0000 Subject: [PATCH] Add a script to create fake judges for testing with --- scripts/judges_fake.php | 145 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 scripts/judges_fake.php diff --git a/scripts/judges_fake.php b/scripts/judges_fake.php new file mode 100644 index 0000000..3805a86 --- /dev/null +++ b/scripts/judges_fake.php @@ -0,0 +1,145 @@ + + Copyright (C) 2005 James Grant + + 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. +*/ +?> +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
\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')"); + } + + +} + +?>