use Sub::Exporter -setup => {
exports => [
- qw(successful_sequential_posts days_remaining_to_post)
+ qw(successful_sequential_posts days_remaining_to_post level_for_post_count)
]
};
sub day_diff ($dt1, $dt2) {
$dt1 = $dt1->at if $dt1->isa('IronMunger::Post');
$dt2 = $dt2->at if $dt2->isa('IronMunger::Post');
- $dt1->delta_days($dt2)->delta_days;
+ my $seconds = $dt2->epoch - $dt1->epoch;
+ $seconds = -$seconds if $seconds < 0;
+ int($seconds / 86400);
+ #$dt1->delta_days($dt2)->delta_days;
}
sub check_post_gap ($aperture, $days, @posts) {
return check_both(\&check_time_remaining, @posts);
}
+sub level_for_post_count($count) {
+ return 'paper' if $count < 4;
+ return 'stone' if $count < 12;
+ return 'bronze' if $count < 36;
+ return 'iron';
+}
+
1;