Skip to content

Commit

Permalink
Fix variables not being created early enough
Browse files Browse the repository at this point in the history
$q_person and %major_to_house were being instantiated after they were
used which was causing the script to fail so move instantiation earlier.
  • Loading branch information
struan committed Apr 3, 2015
1 parent 9e7a36a commit 167f113
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions search/index.pl
Expand Up @@ -87,6 +87,24 @@
$termgenerator->set_stemmer($stemmer);
# $termgenerator->set_stopper();

my $q_person = $dbh->prepare(
"SELECT house, title, first_name, last_name, party, constituency
FROM member
WHERE person_id = ? AND entered_house <= ? and ? <= left_house
ORDER BY entered_house");

my %major_to_house = (
1 => { 1 => 1 },
2 => { 1 => 1 },
3 => { 1 => 1, 2 => 1 },
4 => { 1 => 1, 2 => 1 },
5 => { 3 => 1 },
6 => { 1 => 1 },
7 => { 4 => 1 },
8 => { 4 => 1 },
101 => { 2 => 1 },
);

if ($action ne "check" && $action ne 'checkfull') {

# Batch numbers - each new stuff gets a new batch number
Expand Down Expand Up @@ -320,24 +338,6 @@
}


my $q_person = $dbh->prepare(
"SELECT house, title, first_name, last_name, party, constituency
FROM member
WHERE person_id = ? AND entered_house <= ? and ? <= left_house
ORDER BY entered_house");

my %major_to_house = (
1 => { 1 => 1 },
2 => { 1 => 1 },
3 => { 1 => 1, 2 => 1 },
4 => { 1 => 1, 2 => 1 },
5 => { 3 => 1 },
6 => { 1 => 1 },
7 => { 4 => 1 },
8 => { 4 => 1 },
101 => { 2 => 1 },
);

sub get_person {
my ($person_id, $hdate, $htime, $major) = @_;
return unless $person_id;
Expand Down

0 comments on commit 167f113

Please sign in to comment.