Skip to content

Commit

Permalink
Couple of fixes found while trying to add Ernest Brooksbank
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jun 5, 2023
1 parent 13dda6b commit e8fc576
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Succession/lib/Succession/App.pm
Expand Up @@ -415,7 +415,7 @@ sub make_succ_str_for_date {

$date //= $self->date;

my @succ = @{ $self->succession };
my @succ = @{ $self->model->succession_on_date($date) };

$#succ = $self->list_size - 1 if @succ > $self->list_size;

Expand Down
6 changes: 4 additions & 2 deletions bin/get_change_dates
Expand Up @@ -19,7 +19,7 @@ my $prev_year = 0;
if (@ARGV) {
$date = DateTime::Format::Strptime->new(pattern => '%Y-%m-%d')
->parse_datetime($ARGV[0]);
$prev_succ_str = make_succ_str_for_date($date->clone->subtract( days => 1 ));
$prev_succ_str = $app->make_succ_str_for_date($date->clone->subtract( days => 1 ));
} else {
$date = $app->earliest;
}
Expand All @@ -29,10 +29,12 @@ while ($date <= $app->today) {
warn DateTime->now->time, ' - Starting ', $date->year, "\n";
$prev_year = $date->year;
}
warn "$date\n";
my $succ_str = $app->make_succ_str_for_date($date);
warn "$succ_str\n";

if ($succ_str ne $prev_succ_str) {
say $date->ymd;
say $date->ymd, " - change\n";
$rs->create({
change_date => $date,
succession => $succ_str,
Expand Down

0 comments on commit e8fc576

Please sign in to comment.