Fix recurring transactions calculator for after-the-fact updates
This commit is contained in:
parent
898b6ff8f0
commit
07a36c2268
1 changed files with 9 additions and 10 deletions
|
@ -87,12 +87,11 @@ sub run {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $now = DateTime->now();
|
|
||||||
my $purchase_time = DateTime->new(
|
my $purchase_time = DateTime->new(
|
||||||
year => $now->year,
|
year => $datetime->year,
|
||||||
month => $now->month,
|
month => $datetime->month,
|
||||||
day => $now->day,
|
day => $datetime->day,
|
||||||
hour => $start_time_dt->hour,
|
hour => $start_time_dt->hour,
|
||||||
minute => $start_time_dt->minute,
|
minute => $start_time_dt->minute,
|
||||||
second => $start_time_dt->second,
|
second => $start_time_dt->second,
|
||||||
time_zone => 'UTC',
|
time_zone => 'UTC',
|
||||||
|
@ -102,12 +101,12 @@ sub run {
|
||||||
my $distance = $recur_result->distance;
|
my $distance = $recur_result->distance;
|
||||||
|
|
||||||
my $new_transaction = $schema->resultset('Transaction')->create({
|
my $new_transaction = $schema->resultset('Transaction')->create({
|
||||||
buyer_id => $recur_result->buyer_id,
|
buyer_id => $recur_result->buyer_id,
|
||||||
seller_id => $recur_result->seller_id,
|
seller_id => $recur_result->seller_id,
|
||||||
value => $recur_result->value,
|
value => $recur_result->value,
|
||||||
purchase_time => $app->format_db_datetime($purchase_time),
|
purchase_time => $app->format_db_datetime($purchase_time),
|
||||||
distance => $distance,
|
distance => $distance,
|
||||||
essential => ( defined $essential ? $essential : 0 ),
|
essential => ( defined $essential ? $essential : 0 ),
|
||||||
});
|
});
|
||||||
|
|
||||||
unless ( defined $new_transaction ) {
|
unless ( defined $new_transaction ) {
|
||||||
|
|
Reference in a new issue