Commit | Line | Data |
67e9aef2 |
1 | |
2 | sub check_post_gap (@posts) { |
3 | my $next_post = shift(@posts); |
4 | my $success = 1; |
5 | foreach my $post (@posts) { |
6 | return $success if $next_post->at - $post->at > 7->days; |
7 | $success++; |
8 | $next_post = $post; |
9 | } |
10 | return $success; |
11 | } |
12 | |
13 | sub check_posts_rolling (@posts) { |
14 | return @posts if @posts <= 3; |
15 | my @next_post = splice(@posts, 0, 3); |
16 | my $success = 3; |
17 | foreach my $post (@posts) { |
18 | return $success if $next_post[0]->at - $post->at > 30->days; |
19 | $success++; |
20 | shift(@next_post); |
21 | push(@next_post, $post); |
22 | } |
23 | return $success; |
24 | } |