Fixed all_day calculating from the wrong time

This commit is contained in:
Tom Bloor 2017-08-21 15:16:29 +01:00
parent 6c35bc36e0
commit 3f743f0b5f
3 changed files with 25 additions and 16 deletions

View file

@ -21,6 +21,15 @@ sub search_between {
});
}
sub search_before {
my ( $self, $date ) = @_;
my $dtf = $self->result_source->schema->storage->datetime_parser;
return $self->search({
purchase_time => { '<' => $dtf->format_datetime( $date ) },
});
}
sub today_rs {
my ( $self ) = @_;

View file

@ -215,10 +215,10 @@ test_leaderboard(
'all_time_total',
$now,
[
{ user_id => 4, value => 980 },
{ user_id => 3, value => 940 },
{ user_id => 2, value => 900 },
{ user_id => 1, value => 860 },
{ user_id => 4, value => 885 },
{ user_id => 3, value => 855 },
{ user_id => 2, value => 825 },
{ user_id => 1, value => 795 },
]
);
@ -227,10 +227,10 @@ test_leaderboard(
'all_time_count',
$now,
[
{ user_id => 1, value => 40 },
{ user_id => 2, value => 40 },
{ user_id => 3, value => 40 },
{ user_id => 4, value => 40 },
{ user_id => 1, value => 30 },
{ user_id => 2, value => 30 },
{ user_id => 3, value => 30 },
{ user_id => 4, value => 30 },
]
);

View file

@ -217,10 +217,10 @@ test_leaderboard(
'all_time_total',
$now,
[
{ user_id => 4, value => 980, position => 1 },
{ user_id => 3, value => 940, position => 2 },
{ user_id => 2, value => 900, position => 3 },
{ user_id => 1, value => 860, position => 4 },
{ user_id => 4, value => 885, position => 1 },
{ user_id => 3, value => 855, position => 2 },
{ user_id => 2, value => 825, position => 3 },
{ user_id => 1, value => 795, position => 4 },
]
);
@ -229,10 +229,10 @@ test_leaderboard(
'all_time_count',
$now,
[
{ user_id => 1, value => 40, position => 1 },
{ user_id => 2, value => 40, position => 2 },
{ user_id => 3, value => 40, position => 3 },
{ user_id => 4, value => 40, position => 4 },
{ user_id => 1, value => 30, position => 1 },
{ user_id => 2, value => 30, position => 2 },
{ user_id => 3, value => 30, position => 3 },
{ user_id => 4, value => 30, position => 4 },
]
);