From 377e9e70aaee976bcf3ebaee9de2028cf6e5e6a9 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Fri, 16 Jan 2015 13:20:57 +0000 Subject: [PATCH] Improve the logging output of get_cands. --- bin/get_cands | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/get_cands b/bin/get_cands index 1dbab709ea..bbe57c7d0c 100755 --- a/bin/get_cands +++ b/bin/get_cands @@ -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; @@ -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} / ", @@ -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) {