Add code formatter, format all code

This commit is contained in:
Rumperuu 2021-03-20 12:09:50 +00:00
parent 602a59f1c3
commit 47a55f6322
120 changed files with 8061 additions and 6967 deletions

View file

@ -10,49 +10,51 @@ has description => 'Manage Codepoint Open Data';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
getopt \@args,
'o|outcodes=s' => \my @outcodes,
'q|quiet' => \my $quiet_mode;
getopt \@args,
'o|outcodes=s' => \my @outcodes,
'q|quiet' => \my $quiet_mode;
my $cpo_dir = $self->app->home->child('etc')->child('code-point-open');
my $zip_file = $cpo_dir->child('codepo_gb.zip')->realpath->to_string;
my $output_dir = $cpo_dir->child('codepo_gb')->realpath->to_string;
my $cpo_dir = $self->app->home->child('etc')->child('code-point-open');
my $zip_file = $cpo_dir->child('codepo_gb.zip')->realpath->to_string;
my $output_dir = $cpo_dir->child('codepo_gb')->realpath->to_string;
unless ( -d $output_dir ) {
print "Unzipping code-point-open data\n" unless $quiet_mode;
eval { system( 'unzip', '-q', $zip_file, '-d', $output_dir ) };
if ( my $err = $@ ) {
print "Error extracting zip: " . $err . "\n";
print "Manually create etc/code-point-open/codepo_gb directory and extract zip into it";
die;
unless ( -d $output_dir ) {
print "Unzipping code-point-open data\n" unless $quiet_mode;
eval { system( 'unzip', '-q', $zip_file, '-d', $output_dir ) };
if ( my $err = $@ ) {
print "Error extracting zip: " . $err . "\n";
print
"Manually create etc/code-point-open/codepo_gb directory and extract zip into it";
die;
}
}
}
my $cpo = Geo::UK::Postcode::CodePointOpen->new( path => $output_dir );
my $cpo = Geo::UK::Postcode::CodePointOpen->new( path => $output_dir );
printf( "Importing data for %s outcode(s)\n", @outcodes ? join( ' ', @outcodes ) : 'all' )
unless $quiet_mode;
printf( "Importing data for %s outcode(s)\n",
@outcodes ? join( ' ', @outcodes ) : 'all' )
unless $quiet_mode;
my $iter = $cpo->read_iterator(
outcodes => \@outcodes,
include_lat_long => 1,
split_postcode => 1,
);
my $pc_rs = $self->app->schema->resultset('GbPostcode');
while ( my $pc = $iter->() ) {
$pc_rs->find_or_create(
{
outcode => $pc->{Outcode},
incode => $pc->{Incode},
latitude => $pc->{Latitude},
longitude => $pc->{Longitude},
},
{ key => 'primary' },
my $iter = $cpo->read_iterator(
outcodes => \@outcodes,
include_lat_long => 1,
split_postcode => 1,
);
}
my $pc_rs = $self->app->schema->resultset('GbPostcode');
while ( my $pc = $iter->() ) {
$pc_rs->find_or_create(
{
outcode => $pc->{Outcode},
incode => $pc->{Incode},
latitude => $pc->{Latitude},
longitude => $pc->{Longitude},
},
{ key => 'primary' },
);
}
}
=head1 SYNOPSIS

View file

@ -8,79 +8,88 @@ has description => 'Input Dev Data';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
getopt \@args,
'f|force' => \my $force;
getopt \@args, 'f|force' => \my $force;
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
if ( ( defined( $ENV{MOJO_MODE} ) && $ENV{MOJO_MODE} eq 'production' ) || $self->app->mode eq 'production' ) {
say "Will not run dev data fixtures in production!";
return;
}
if ( ( defined( $ENV{MOJO_MODE} ) && $ENV{MOJO_MODE} eq 'production' )
|| $self->app->mode eq 'production' )
{
say "Will not run dev data fixtures in production!";
return;
}
my $schema = $self->app->schema;
my $schema = $self->app->schema;
$schema->resultset('User')->create({
email => 'test@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User',
display_name => 'Test User',
year_of_birth => 2006,
postcode => 'LA1 1AA',
}
},
is_admin => 1,
});
$schema->resultset('User')->create(
{
email => 'test@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User',
display_name => 'Test User',
year_of_birth => 2006,
postcode => 'LA1 1AA',
}
},
is_admin => 1,
}
);
$schema->resultset('User')->create({
email => 'test2@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User 2',
display_name => 'Test User 2',
year_of_birth => 2006,
postcode => 'LA1 1AA',
},
},
});
$schema->resultset('User')->create(
{
email => 'test2@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User 2',
display_name => 'Test User 2',
year_of_birth => 2006,
postcode => 'LA1 1AA',
},
},
}
);
$schema->resultset('User')->create({
email => 'test3@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User 3',
display_name => 'Test User 3',
year_of_birth => 2006,
postcode => 'LA1 1AA',
},
},
});
$schema->resultset('User')->create(
{
email => 'test3@example.com',
password => 'abc123',
entity => {
type => 'customer',
customer => {
full_name => 'Test User 3',
display_name => 'Test User 3',
year_of_birth => 2006,
postcode => 'LA1 1AA',
},
},
}
);
$schema->resultset('User')->create({
email => 'testorg@example.com',
password => 'abc123',
entity => {
type => 'organisation',
organisation => {
name => 'Test Org',
street_name => 'Test Street',
town => 'Lancaster',
postcode => 'LA1 1AA',
},
},
});
$schema->resultset('User')->create(
{
email => 'testorg@example.com',
password => 'abc123',
entity => {
type => 'organisation',
organisation => {
name => 'Test Org',
street_name => 'Test Street',
town => 'Lancaster',
postcode => 'LA1 1AA',
},
},
}
);
}
=head1 SYNOPSIS

View file

@ -1,4 +1,5 @@
package Pear::LocalLoop::Command::dev_transactions;
use Mojo::Base 'Mojolicious::Command';
use Mojo::Util 'getopt';
@ -11,73 +12,84 @@ has description => 'Input Dev Transaction';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
getopt \@args,
'f|force' => \my $force,
'd|date=s' => \my $date,
'n|number=i' => \my $number,
'c|count=i' => \my $count;
getopt \@args,
'f|force' => \my $force,
'd|date=s' => \my $date,
'n|number=i' => \my $number,
'c|count=i' => \my $count;
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
if ( ( defined( $ENV{MOJO_MODE} ) && $ENV{MOJO_MODE} eq 'production' ) || $self->app->mode eq 'production' ) {
say "Will not run dev data fixtures in production!";
return;
}
my $date_formatter = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d'
);
my $datetime;
if ( defined $date ) {
$datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
return;
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
} else {
$datetime = DateTime->today;
}
my $schema = $self->app->schema;
my $user_rs = $schema->resultset('User');
my $organisation_rs = $user_rs->search({ customer_id => undef });
my $dtf = $schema->storage->datetime_parser;
my @organisations = $organisation_rs->all;
unless ( defined $number ) {
$number = 1;
}
unless ( defined $count ) {
$count = 0;
}
for my $day_sub ( 0 .. $count ) {
$datetime->subtract( days => 1 );
for ( 1 .. $number ) {
for my $user_result ( $user_rs->all ) {
$user_result->create_related( 'transactions', {
seller_id => $organisations[int(rand($#organisations))]->organisation_id,
value => int(rand(9999)) / 100,
proof_image => 'a',
purchase_time => $dtf->format_datetime($datetime->clone->add( minutes => int(rand(1440)) )),
});
}
if ( ( defined( $ENV{MOJO_MODE} ) && $ENV{MOJO_MODE} eq 'production' )
|| $self->app->mode eq 'production' )
{
say "Will not run dev data fixtures in production!";
return;
}
my $date_formatter =
DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' );
my $datetime;
if ( defined $date ) {
$datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
return;
}
}
else {
$datetime = DateTime->today;
}
my $schema = $self->app->schema;
my $user_rs = $schema->resultset('User');
my $organisation_rs = $user_rs->search( { customer_id => undef } );
my $dtf = $schema->storage->datetime_parser;
my @organisations = $organisation_rs->all;
unless ( defined $number ) {
$number = 1;
}
unless ( defined $count ) {
$count = 0;
}
for my $day_sub ( 0 .. $count ) {
$datetime->subtract( days => 1 );
for ( 1 .. $number ) {
for my $user_result ( $user_rs->all ) {
$user_result->create_related(
'transactions',
{
seller_id =>
$organisations[ int( rand($#organisations) ) ]
->organisation_id,
value => int( rand(9999) ) / 100,
proof_image => 'a',
purchase_time => $dtf->format_datetime(
$datetime->clone->add(
minutes => int( rand(1440) )
)
),
}
);
}
}
}
}
}
=head1 SYNOPSIS

View file

@ -11,63 +11,77 @@ has description => 'Set lat/long data on customers and orgs';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
my $customer_rs = $self->app->schema->resultset('Customer');
my $org_rs = $self->app->schema->resultset('Organisation');
my $customer_rs = $self->app->schema->resultset('Customer');
my $org_rs = $self->app->schema->resultset('Organisation');
for my $result ( $customer_rs->all, $org_rs->all ) {
$self->_set_lat_long_for_result( $result );
}
for my $result ( $customer_rs->all, $org_rs->all ) {
$self->_set_lat_long_for_result($result);
}
my $transaction_rs = $self->app->schema->resultset('Transaction');
my $transaction_rs = $self->app->schema->resultset('Transaction');
for my $result ( $transaction_rs->all ) {
my $distance = $self->_calculate_distance(
$result->buyer->${\$result->buyer->type},
$result->seller->${\$result->seller->type},
);
$result->update({ distance => $distance }) if defined $distance;
}
for my $result ( $transaction_rs->all ) {
my $distance = $self->_calculate_distance(
$result->buyer->${ \$result->buyer->type },
$result->seller->${ \$result->seller->type },
);
$result->update( { distance => $distance } ) if defined $distance;
}
}
sub _set_lat_long_for_result {
my ( $self, $result ) = @_;
my ( $self, $result ) = @_;
my $parsed_postcode = Geo::UK::Postcode::Regex->parse($result->postcode);
my $pc_rs = $self->app->schema->resultset('GbPostcode');
my $parsed_postcode = Geo::UK::Postcode::Regex->parse( $result->postcode );
my $pc_rs = $self->app->schema->resultset('GbPostcode');
if ( $parsed_postcode->{valid} && !$parsed_postcode->{non_geographical} ) {
my $gb_pc = $pc_rs->find({
outcode => $parsed_postcode->{outcode},
incode => $parsed_postcode->{incode},
});
if ( $gb_pc ) {
$result->update({
latitude => $gb_pc->latitude,
longitude => $gb_pc->longitude,
});
if ( $parsed_postcode->{valid} && !$parsed_postcode->{non_geographical} ) {
my $gb_pc = $pc_rs->find(
{
outcode => $parsed_postcode->{outcode},
incode => $parsed_postcode->{incode},
}
);
if ($gb_pc) {
$result->update(
{
latitude => $gb_pc->latitude,
longitude => $gb_pc->longitude,
}
);
}
}
}
}
sub _calculate_distance {
my ( $self, $buyer, $seller ) = @_;
my ( $self, $buyer, $seller ) = @_;
my $gis = GIS::Distance->new();
my $gis = GIS::Distance->new();
my $buyer_lat = $buyer->latitude;
my $buyer_long = $buyer->longitude;
my $seller_lat = $seller->latitude;
my $seller_long = $seller->longitude;
my $buyer_lat = $buyer->latitude;
my $buyer_long = $buyer->longitude;
my $seller_lat = $seller->latitude;
my $seller_long = $seller->longitude;
if ( $buyer_lat && $buyer_long
&& $seller_lat && $seller_long ) {
return $gis->distance( $buyer_lat, $buyer_long => $seller_lat, $seller_long )->meters;
} else {
print STDERR "missing lat-long for: " . $buyer->name . " or " . $seller->name . "\n";
}
return;
if ( $buyer_lat
&& $buyer_long
&& $seller_lat
&& $seller_long )
{
return $gis->distance(
$buyer_lat,
$buyer_long => $seller_lat,
$seller_long
)->meters;
}
else {
print STDERR "missing lat-long for: "
. $buyer->name . " or "
. $seller->name . "\n";
}
return;
}
=head1 SYNOPSIS

View file

@ -8,65 +8,69 @@ has description => 'Build leaderboards';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
getopt \@args,
't|type=s' => \my $type,
'l|list' => \my $list,
'd|date=s' => \my $date;
getopt \@args,
't|type=s' => \my $type,
'l|list' => \my $list,
'd|date=s' => \my $date;
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
if ( defined $list ) {
say sprintf('%20s : %20s', 'Type', 'Name');
for my $leaderboard ( $leaderboard_rs->all ) {
say sprintf('%20s : %20s', $leaderboard->type, $leaderboard->name);
}
return;
}
if ( defined $type ) {
my $leaderboard = $leaderboard_rs->find({ type => $type });
unless ( defined $leaderboard ) {
say "Unknown Leaderboard Type";
return;
}
if ( defined $date ) {
say "Creating leaderboard of type $type with date $date";
my $date_formatter = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d'
);
my $datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
if ( defined $list ) {
say sprintf( '%20s : %20s', 'Type', 'Name' );
for my $leaderboard ( $leaderboard_rs->all ) {
say
sprintf( '%20s : %20s', $leaderboard->type, $leaderboard->name );
}
return;
}
my $dtf = $self->app->schema->storage->datetime_parser;
my $existing_leaderboard_set = $leaderboard->search_related( 'sets', {
date => $dtf->format_datetime( $datetime ),
})->first;
if ( defined $existing_leaderboard_set ) {
$existing_leaderboard_set->values->delete_all;
$existing_leaderboard_set->delete;
}
$leaderboard->create_new($datetime);
say "Done";
} else {
say 'Leaderboards of type ' . $type . ' available:';
for my $set ( $leaderboard->sets->all ) {
say $set->date;
}
}
}
if ( defined $type ) {
my $leaderboard = $leaderboard_rs->find( { type => $type } );
unless ( defined $leaderboard ) {
say "Unknown Leaderboard Type";
return;
}
if ( defined $date ) {
say "Creating leaderboard of type $type with date $date";
my $date_formatter =
DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' );
my $datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
return;
}
my $dtf = $self->app->schema->storage->datetime_parser;
my $existing_leaderboard_set = $leaderboard->search_related(
'sets',
{
date => $dtf->format_datetime($datetime),
}
)->first;
if ( defined $existing_leaderboard_set ) {
$existing_leaderboard_set->values->delete_all;
$existing_leaderboard_set->delete;
}
$leaderboard->create_new($datetime);
say "Done";
}
else {
say 'Leaderboards of type ' . $type . ' available:';
for my $set ( $leaderboard->sets->all ) {
say $set->date;
}
}
}
}
=head1 SYNOPSIS

View file

@ -8,11 +8,11 @@ has description => 'Build All leaderboards';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
$leaderboard_rs->recalculate_all;
$leaderboard_rs->recalculate_all;
}
=head1 SYNOPSIS

View file

@ -11,119 +11,148 @@ has description => 'Recur Transactions';
has usage => sub { shift->extract_usage };
sub run {
my ( $self, @args ) = @_;
my ( $self, @args ) = @_;
my $app = $self->app;
my $app = $self->app;
getopt \@args,
'f|force' => \my $force,
'd|date=s' => \my $date;
getopt \@args,
'f|force' => \my $force,
'd|date=s' => \my $date;
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
my $date_formatter = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d'
);
my $datetime;
if ( defined $date ) {
$datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
return;
}
} else {
$datetime = DateTime->today;
}
my $match_date_day = $app->format_iso_date($datetime->clone->subtract( days => 1 ));
my $match_date_week = $app->format_iso_date($datetime->clone->subtract( weeks => 1 ));
my $match_date_fortnight = $app->format_iso_date($datetime->clone->subtract( weeks => 2 ));
my $match_date_month = $app->format_iso_date($datetime->clone->subtract( months => 1 ));
my $match_date_quarter = $app->format_iso_date($datetime->clone->subtract( months => 3));
my $match_date_year = $app->format_iso_date($datetime->clone->subtract( years => 1 ));
my $schema = $app->schema;
my $dtf = $schema->storage->datetime_parser;
my $recur_rs = $schema->resultset('TransactionRecurring');
for my $recur_result ( $recur_rs->all ) {
my $start_time_dt;
if ( defined $recur_result->last_updated ) {
$start_time_dt = $recur_result->last_updated;
} else {
$start_time_dt = $recur_result->start_time;
}
my $start_time = $app->format_iso_date($start_time_dt);
my $recurring_period = $recur_result->recurring_period;
if ( $recurring_period eq 'daily' ) {
next unless $start_time eq $match_date_day;
say "matched recurring transaction ID " . $recur_result->id . " to daily";
} elsif ( $recurring_period eq 'weekly' ) {
next unless $start_time eq $match_date_week;
say "matched recurring transaction ID " . $recur_result->id . " to weekly";
} elsif ( $recurring_period eq 'fortnightly' ) {
next unless $start_time eq $match_date_fortnight;
say "matched recurring transaction ID " . $recur_result->id . " to fortnightly";
} elsif ( $recurring_period eq 'monthly' ) {
next unless $start_time eq $match_date_month;
say "matched recurring transaction ID " . $recur_result->id . " to monthly";
} elsif ( $recurring_period eq 'quarterly' ) {
next unless $start_time eq $match_date_quarter;
say "matched recurring transaction ID " . $recur_result->id . " to quarterly";
} elsif ( $recurring_period eq 'yearly' ) {
next unless $start_time eq $match_date_year;
say "matched recurring transaction ID " . $recur_result->id . " to yearly";
} else {
say "Invalid recurring time period given";
return;
unless ( defined $force ) {
say "Will not do anything without force option";
return;
}
my $purchase_time = DateTime->new(
year => $datetime->year,
month => $datetime->month,
day => $datetime->day,
hour => $start_time_dt->hour,
minute => $start_time_dt->minute,
second => $start_time_dt->second,
time_zone => 'UTC',
);
my $category = $recur_result->category_id;
my $essential = $recur_result->essential;
my $distance = $recur_result->distance;
my $date_formatter =
DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' );
my $new_transaction = $schema->resultset('Transaction')->create({
buyer_id => $recur_result->buyer_id,
seller_id => $recur_result->seller_id,
value => $recur_result->value,
purchase_time => $app->format_db_datetime($purchase_time),
distance => $distance,
essential => ( defined $essential ? $essential : 0 ),
});
my $datetime;
unless ( defined $new_transaction ) {
say "Error Adding Transaction";
return;
if ( defined $date ) {
$datetime = $date_formatter->parse_datetime($date);
unless ( defined $datetime ) {
say "Unrecognised date format, please use 'YYYY-MM-DD' Format";
return;
}
}
else {
$datetime = DateTime->today;
}
if ( defined $category ) {
$schema->resultset('TransactionCategory')->create({
category_id => $category,
transaction_id => $new_transaction->id,
});
my $match_date_day =
$app->format_iso_date( $datetime->clone->subtract( days => 1 ) );
my $match_date_week =
$app->format_iso_date( $datetime->clone->subtract( weeks => 1 ) );
my $match_date_fortnight =
$app->format_iso_date( $datetime->clone->subtract( weeks => 2 ) );
my $match_date_month =
$app->format_iso_date( $datetime->clone->subtract( months => 1 ) );
my $match_date_quarter =
$app->format_iso_date( $datetime->clone->subtract( months => 3 ) );
my $match_date_year =
$app->format_iso_date( $datetime->clone->subtract( years => 1 ) );
my $schema = $app->schema;
my $dtf = $schema->storage->datetime_parser;
my $recur_rs = $schema->resultset('TransactionRecurring');
for my $recur_result ( $recur_rs->all ) {
my $start_time_dt;
if ( defined $recur_result->last_updated ) {
$start_time_dt = $recur_result->last_updated;
}
else {
$start_time_dt = $recur_result->start_time;
}
my $start_time = $app->format_iso_date($start_time_dt);
my $recurring_period = $recur_result->recurring_period;
if ( $recurring_period eq 'daily' ) {
next unless $start_time eq $match_date_day;
say "matched recurring transaction ID "
. $recur_result->id
. " to daily";
}
elsif ( $recurring_period eq 'weekly' ) {
next unless $start_time eq $match_date_week;
say "matched recurring transaction ID "
. $recur_result->id
. " to weekly";
}
elsif ( $recurring_period eq 'fortnightly' ) {
next unless $start_time eq $match_date_fortnight;
say "matched recurring transaction ID "
. $recur_result->id
. " to fortnightly";
}
elsif ( $recurring_period eq 'monthly' ) {
next unless $start_time eq $match_date_month;
say "matched recurring transaction ID "
. $recur_result->id
. " to monthly";
}
elsif ( $recurring_period eq 'quarterly' ) {
next unless $start_time eq $match_date_quarter;
say "matched recurring transaction ID "
. $recur_result->id
. " to quarterly";
}
elsif ( $recurring_period eq 'yearly' ) {
next unless $start_time eq $match_date_year;
say "matched recurring transaction ID "
. $recur_result->id
. " to yearly";
}
else {
say "Invalid recurring time period given";
return;
}
my $purchase_time = DateTime->new(
year => $datetime->year,
month => $datetime->month,
day => $datetime->day,
hour => $start_time_dt->hour,
minute => $start_time_dt->minute,
second => $start_time_dt->second,
time_zone => 'UTC',
);
my $category = $recur_result->category_id;
my $essential = $recur_result->essential;
my $distance = $recur_result->distance;
my $new_transaction = $schema->resultset('Transaction')->create(
{
buyer_id => $recur_result->buyer_id,
seller_id => $recur_result->seller_id,
value => $recur_result->value,
purchase_time => $app->format_db_datetime($purchase_time),
distance => $distance,
essential => ( defined $essential ? $essential : 0 ),
}
);
unless ( defined $new_transaction ) {
say "Error Adding Transaction";
return;
}
if ( defined $category ) {
$schema->resultset('TransactionCategory')->create(
{
category_id => $category,
transaction_id => $new_transaction->id,
}
);
}
$recur_result->update( { last_updated => $purchase_time } );
}
$recur_result->update({ last_updated => $purchase_time });
}
}
=head1 SYNOPSIS