Add explicit returns

This commit is contained in:
Rumperuu 2021-03-20 15:02:00 +00:00
parent ee7fe2c7b4
commit c5c074903d
44 changed files with 191 additions and 11 deletions

View file

@ -55,6 +55,8 @@ sub run {
{ key => 'primary' },
);
}
return 1;
}
=head1 SYNOPSIS

View file

@ -90,6 +90,8 @@ sub run {
},
}
);
return 1;
}
=head1 SYNOPSIS

View file

@ -90,6 +90,8 @@ sub run {
}
}
}
return 1;
}
=head1 SYNOPSIS

View file

@ -29,6 +29,8 @@ sub run {
);
$result->update( { distance => $distance } ) if defined $distance;
}
return 1;
}
sub _set_lat_long_for_result {
@ -53,6 +55,8 @@ sub _set_lat_long_for_result {
);
}
}
return 1;
}
sub _calculate_distance {

View file

@ -71,6 +71,8 @@ sub run {
}
}
}
return 1;
}
=head1 SYNOPSIS

View file

@ -13,6 +13,8 @@ sub run {
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
$leaderboard_rs->recalculate_all;
return 1;
}
=head1 SYNOPSIS

View file

@ -153,6 +153,8 @@ sub run {
$recur_result->update( { last_updated => $purchase_time } );
}
return 1;
}
=head1 SYNOPSIS

View file

@ -34,6 +34,8 @@ sub home {
pending => $pending_feedback_rs->count,
},
);
return 1;
}
sub auth_login {
@ -52,6 +54,8 @@ sub auth_login {
. "]" );
$c->redirect_to('/admin');
}
return 1;
}
sub auth_logout {
@ -59,6 +63,8 @@ sub auth_logout {
$c->logout;
$c->redirect_to('/admin');
return 1;
}
1;

View file

@ -12,6 +12,8 @@ sub index {
my $category_rs = $c->result_set;
$category_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash( categories => [ $category_rs->all ] );
return 1;
}
# POST
@ -43,6 +45,8 @@ sub create {
$c->result_set->create( { name => $category_name } );
}
$c->redirect_to('/admin/categories');
return 1;
}
# GET
@ -58,6 +62,8 @@ sub read {
$c->flash( error => 'No Category found' );
$c->redirect_to('/admin/categories');
}
return 1;
}
# POST
@ -95,6 +101,8 @@ sub update {
$c->flash( error => 'No Category found' );
$c->redirect_to('/admin/categories');
}
return 1;
}
# DELETE
@ -112,6 +120,8 @@ sub delete {
$c->flash( error => 'No Category found' );
}
$c->redirect_to('/admin/categories');
return 1;
}
1;

View file

@ -18,6 +18,8 @@ sub index {
},
);
$c->stash( feedback_rs => $feedback_rs );
return 1;
}
sub read {
@ -32,6 +34,8 @@ sub read {
$c->flash( error => 'No Feedback found' );
$c->redirect_to('/admin/feedback');
}
return 1;
}
sub actioned {
@ -48,6 +52,8 @@ sub actioned {
$c->flash( error => 'No Feedback found' );
$c->redirect_to('/admin/feedback');
}
return 1;
}
1;

View file

@ -21,6 +21,8 @@ sub index {
},
);
$c->stash( import_rs => $import_rs );
return 1;
}
sub list {
@ -46,10 +48,14 @@ sub list {
import_org_rs => $import_org_rs,
import_lookup_rs => $import_lookup_rs,
);
return 1;
}
sub get_add {
my $c = shift;
return 1;
}
sub post_add {
@ -147,6 +153,8 @@ sub post_add {
$c->flash( success => 'Created Value Set' );
$c->redirect_to( '/admin/import/' . $value_set->id );
return 1;
}
sub _csv_flash_error {
@ -160,6 +168,8 @@ sub _csv_flash_error {
#csv_data => $c->param('csv'),
date_format => $c->param('date_format'),
);
return 1;
}
sub get_user {
@ -209,6 +219,8 @@ sub get_user {
lookup => $lookup_result,
user_name => $user_name,
);
return 1;
}
sub get_org {
@ -258,6 +270,8 @@ sub get_org {
lookup => $lookup_result,
org_name => $org_name,
);
return 1;
}
sub ignore_value {

View file

@ -15,6 +15,8 @@ sub index {
];
$c->app->max_request_size(104857600);
return 1;
}
sub post_suppliers {
@ -130,6 +132,8 @@ sub org_search {
);
$c->render( json => \@results );
return 1;
}
1;

View file

@ -21,10 +21,14 @@ sub list {
);
$c->stash( orgs_rs => $orgs_rs, );
return 1;
}
sub add_org {
my $c = shift;
return 1;
}
sub add_org_submit {
@ -87,6 +91,8 @@ sub add_org_submit {
$c->redirect_to( '/admin/organisations/' . $organisation->id );
}
};
return 1;
}
sub valid_read {
@ -112,6 +118,8 @@ sub valid_read {
transactions => $transactions,
associations => $assoc,
);
return 1;
}
sub valid_edit {
@ -183,6 +191,8 @@ sub valid_edit {
}
};
$c->redirect_to( '/admin/organisations/' . $c->param('id') );
return 1;
}
sub merge_list {
@ -212,6 +222,8 @@ sub merge_list {
org_result => $org_result,
org_rs => $org_rs,
);
return 1;
}
sub merge_detail {
@ -239,6 +251,8 @@ sub merge_detail {
org_result => $org_result,
target_result => $target_result,
);
return 1;
}
sub merge_confirm {
@ -295,6 +309,8 @@ sub merge_confirm {
}
$c->redirect_to(
'/admin/organisations/' . $org_id . '/merge/' . $target_id );
return 1;
}
1;

View file

@ -59,6 +59,8 @@ sub transaction_data {
json => { json => { data => $transaction_data } },
html => { transaction_rs => encode_json($transaction_data) },
);
return 1;
}
sub pg_or_sqlite {

View file

@ -12,6 +12,8 @@ sub index {
my $token_rs = $c->result_set;
$token_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash( tokens => [ $token_rs->all ] );
return 1;
}
# POST
@ -43,6 +45,8 @@ sub create {
$c->result_set->create( { name => $token_name } );
}
$c->redirect_to('/admin/tokens');
return 1;
}
# GET
@ -58,6 +62,8 @@ sub read {
$c->flash( error => 'No Token found' );
$c->redirect_to('/admin/tokens');
}
return 1;
}
# POST
@ -89,6 +95,8 @@ sub update {
$c->flash( error => 'No Token found' );
$c->redirect_to('/admin/tokens');
}
return 1;
}
# DELETE
@ -105,6 +113,8 @@ sub delete {
$c->flash( error => 'No Token found' );
}
$c->redirect_to('/admin/tokens');
return 1;
}
1;

View file

@ -66,6 +66,8 @@ sub index {
count => $count,
},
);
return 1;
}
sub read {
@ -80,6 +82,8 @@ sub read {
$c->flash( error => 'No transaction found' );
$c->redirect_to('/admin/transactions');
}
return 1;
}
sub image {
@ -95,6 +99,8 @@ sub image {
else {
$c->reply->static('image/no_transaction.jpg');
}
return 1;
}
sub delete {
@ -114,6 +120,8 @@ sub delete {
$c->flash( error => 'No transaction found' );
$c->redirect_to('/admin/transactions');
}
return 1;
}
sub pg_or_sqlite {

View file

@ -32,6 +32,8 @@ sub index {
}
);
$c->stash( user_rs => $user_rs );
return 1;
}
sub read {
@ -57,6 +59,8 @@ sub read {
$c->flash( error => 'No User found' );
$c->redirect_to('/admin/users');
}
return 1;
}
sub update {
@ -189,6 +193,8 @@ sub update {
}
$c->redirect_to( '/admin/users/' . $id );
return 1;
}
1;

View file

@ -139,6 +139,8 @@ sub post_logout {
message => 'Logged Out',
}
);
return 1;
}
1;

View file

@ -122,6 +122,8 @@ sub index {
}
},
);
return 1;
}
sub trail_load {
@ -204,6 +206,8 @@ sub trail_load {
}
},
);
return 1;
}
1;

View file

@ -7,6 +7,8 @@ sub index {
# if ( $c->is_user_authenticated ) {
# $c->redirect_to('/home');
# }
return 1;
}
sub under {
@ -28,6 +30,8 @@ sub auth_login {
else {
$c->redirect_to('/');
}
return 1;
}
sub auth_logout {
@ -35,10 +39,14 @@ sub auth_logout {
$c->logout;
$c->redirect_to('/');
return 1;
}
sub home {
my $c = shift;
return 1;
}
1;

View file

@ -24,6 +24,8 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result($row);
}
return 1;
}
sub _row_to_result {
@ -45,6 +47,8 @@ sub _row_to_result {
return if $postcode_r->ward;
$postcode_r->update( { ward_id => $ward->id } );
return 1;
}
1;

View file

@ -22,6 +22,8 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result($row);
}
return 1;
}
sub _row_to_result {
@ -56,6 +58,8 @@ sub _row_to_result {
}
}
);
return 1;
}
1;

View file

@ -46,6 +46,8 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result( $row, $lcc_org );
}
return 1;
}
sub _row_to_result {
@ -181,6 +183,8 @@ sub _row_to_result {
),
}
);
return 1;
}
1;

View file

@ -176,7 +176,8 @@ sub register {
return b($html);
}
);
return 1;
}
1;

View file

@ -24,6 +24,8 @@ sub register {
return sprintf( '£%.2f', $value / 100000 );
}
);
return 1;
}
1;

View file

@ -95,6 +95,7 @@ sub register {
}
);
return 1;
}
1;

View file

@ -34,7 +34,8 @@ sub register {
else {
$app->log->debug('No Minion Config');
}
return 1;
}
1;

View file

@ -10,6 +10,8 @@ sub run {
csv_file => $filename,
schema => $self->app->schema
)->import_csv;
return 1;
}
1;

View file

@ -10,6 +10,8 @@ sub run {
csv_file => $filename,
schema => $self->app->schema
)->import_csv;
return 1;
}
1;

View file

@ -11,6 +11,8 @@ sub run {
schema => $self->app->schema,
target_entity_id => $entity_id,
)->import_csv;
return 1;
}
1;

View file

@ -30,6 +30,8 @@ sub run {
}
}
}
return 1;
}
1;

View file

@ -7,6 +7,8 @@ sub run {
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
$leaderboard_rs->recalculate_all;
return 1;
}
1;

View file

@ -8,6 +8,8 @@ sub run {
for my $arg (@args) {
$self->job->app->log->debug($arg);
}
return 1;
}
1;

View file

@ -71,6 +71,8 @@ sub register {
return;
}
);
return 1;
}
1;

View file

@ -15,7 +15,8 @@ sub register {
}
}
);
return 1;
}
1;

View file

@ -101,6 +101,8 @@ sub register {
);
$app->helper( validation_error => sub { _validation_error(@_) } );
return 1;
}
=head2 validation_error

View file

@ -146,6 +146,8 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}
sub to_bool {

View file

@ -103,6 +103,8 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}
1;

View file

@ -84,6 +84,12 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->filter_column(
is_admin => {
filter_to_storage => 'to_bool',
}
);
sub sqlt_deploy_hook {
my ( $source_instance, $sqlt_table ) = @_;
my $pending_field = $sqlt_table->get_field('is_admin');
@ -93,14 +99,10 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}
__PACKAGE__->filter_column(
is_admin => {
filter_to_storage => 'to_bool',
}
);
sub to_bool {
my ( $self, $val ) = @_;
my $driver_name =

View file

@ -5,7 +5,7 @@ use warnings;
use base 'DBIx::Class::ResultSet';
sub sales { shift->search_related( 'sales', @_ ) }
sub sales { return shift->search_related( 'sales', @_ ) }
sub create_org {
my ( $self, $org ) = @_;
@ -16,6 +16,8 @@ sub create_org {
type => 'organisation',
}
);
return 1;
}
1;

View file

@ -92,6 +92,8 @@ sub recalculate_all {
warn "Unrecognised Set";
}
}
return 1;
}
sub _recalculate_leaderboard {
@ -105,6 +107,8 @@ sub _recalculate_leaderboard {
$lb_result->create_new($date);
}
);
return 1;
}
1;

View file

@ -5,6 +5,6 @@ use warnings;
use base 'DBIx::Class::ResultSet';
sub entity { shift->search_related( 'entity', @_ ) }
sub entity { return shift->search_related( 'entity', @_ ) }
1;

View file

@ -207,6 +207,8 @@ sub cmd_write_ddl {
}
);
}
return 1;
}
=head2 install_dh
@ -225,6 +227,8 @@ sub cmd_install_dh {
version => $self->version,
}
);
return 1;
}
=head2 install
@ -241,6 +245,8 @@ sub cmd_install {
version => $self->version,
}
);
return 1;
}
=head2 upgrade
@ -253,6 +259,8 @@ sub cmd_upgrade {
my ($self) = @_;
$self->dh->upgrade;
return 1;
}
=head1 AUTHOR

View file

@ -14,6 +14,8 @@ sub BUILD {
or die "you need Test::PostgreSQL to run PG testing";
Test::PostgreSQL->import;
}
return 1;
}
sub DEMOLISH {
@ -23,6 +25,8 @@ sub DEMOLISH {
$self->mojo->app->schema->storage->dbh->disconnect;
$self->pg->stop;
}
return 1;
}
has pg => (
@ -141,6 +145,8 @@ sub register_customer {
$self->framework->post_ok( '/api/register' => json => $json )
->status_is(200)->or( $self->dump_error )
->json_is( '/success', Mojo::JSON->true )->or( $self->dump_error );
return 1;
}
sub register_organisation {
@ -151,6 +157,8 @@ sub register_organisation {
$self->framework->post_ok( '/api/register' => json => $args )
->status_is(200)->or( $self->dump_error )
->json_is( '/success', Mojo::JSON->true )->or( $self->dump_error );
return 1;
}
sub login {
@ -172,6 +180,8 @@ sub logout {
'/api/logout' => json => { session_key => $session_key } )
->status_is(200)->json_is( '/success', Mojo::JSON->true )
->json_like( '/message', qr/Logged Out/ );
return 1;
}
sub gen_upload {
@ -187,6 +197,8 @@ sub gen_upload {
json => Mojo::JSON::encode_json($args),
file => $file,
};
return 1;
}
sub install_fixtures {
@ -241,6 +253,8 @@ sub install_fixtures {
}
);
}
return 1;
}
1;