Skip to content

Commit

Permalink
Improve the logging output of get_cands.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Cross committed Jan 16, 2015
1 parent e1bd300 commit 377e9e7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bin/get_cands
Expand Up @@ -9,10 +9,14 @@ use open IO => ':encoding(utf8)';
use JSON;
use LWP::Simple;
use DateTime;
use Getopt::Long;

use lib 'lib';
use TwittElection::Schema;

my $verbose;
GetOptions(verbose => \$verbose);

my $sch = TwittElection::Schema->get_schema;

my $cons_rs;
Expand Down Expand Up @@ -84,7 +88,7 @@ foreach my $con ($cons_rs->all) {
} else {
say "* No change $cand->{name} / ",
$cand->{party_memberships}{2015}{name},
" / \@$cand->{twitter_username}";
" / \@$cand->{twitter_username}" if $verbose;
}
} else {
say "* Adding $cand->{name} / ",
Expand All @@ -103,9 +107,11 @@ foreach my $con ($cons_rs->all) {

# Any candidates left in %curr_cands need to be deleted
foreach (keys %curr_cands) {
$can_rs->search({
yournextmp_id => $_,
})->delete;
my $curr_cand = $curr_cands{$_};
say '* Deleting ', $curr_cand->name, ' / ',
$curr_cand->party->name,
' / ', $curr_cand->twitter;
$curr_cand->delete;
}

if ($changed) {
Expand Down

0 comments on commit 377e9e7

Please sign in to comment.