Fix remaining linter errors
This commit is contained in:
parent
6399354b80
commit
1f6225e506
9 changed files with 28 additions and 18 deletions
|
@ -71,6 +71,7 @@ sub post_add {
|
|||
}
|
||||
);
|
||||
|
||||
## no critic (InputOutput::RequireBriefOpen)
|
||||
open my $fh, '<', \$csv_data;
|
||||
|
||||
# List context returns the actual headers
|
||||
|
@ -100,6 +101,9 @@ sub post_add {
|
|||
|
||||
my $csv_output = $csv->getline_hr_all($fh);
|
||||
|
||||
close $fh;
|
||||
## use critic
|
||||
|
||||
unless ( scalar(@$csv_output) ) {
|
||||
$c->_csv_flash_error("No data found");
|
||||
$c->redirect_to('/admin/import/add');
|
||||
|
|
|
@ -123,7 +123,7 @@ sub valid_read {
|
|||
}
|
||||
|
||||
sub valid_edit {
|
||||
my $c = shift;
|
||||
my ($c, $warning) = @_;
|
||||
|
||||
my $validation = $c->validation;
|
||||
$validation->required('name');
|
||||
|
@ -180,9 +180,9 @@ sub valid_edit {
|
|||
);
|
||||
}
|
||||
finally {
|
||||
if (@_) {
|
||||
if ($warning) {
|
||||
use Devel::Dwarn;
|
||||
Dwarn \@_;
|
||||
Dwarn \$warning;
|
||||
$c->flash(
|
||||
error => 'Something went wrong Updating the Organisation' );
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ sub read {
|
|||
## no critic (Subroutines::ProhibitBuiltinHomonyms)
|
||||
sub update {
|
||||
## use critic
|
||||
my $c = shift;
|
||||
my ($c, $error) = @_;
|
||||
|
||||
my $id = $c->param('id');
|
||||
|
||||
|
@ -145,9 +145,9 @@ sub update {
|
|||
);
|
||||
}
|
||||
finally {
|
||||
if (@_) {
|
||||
if ($error) {
|
||||
$c->flash( error => 'Something went wrong Updating the User' );
|
||||
$c->app->log->warn( Dumper @_ );
|
||||
$c->app->log->warn( Dumper $error );
|
||||
}
|
||||
else {
|
||||
$c->flash( success => 'Updated User' );
|
||||
|
@ -188,9 +188,9 @@ sub update {
|
|||
);
|
||||
}
|
||||
finally {
|
||||
if (@_) {
|
||||
if ($error) {
|
||||
$c->flash( error => 'Something went wrong Updating the User' );
|
||||
$c->app->log->warn( Dumper @_ );
|
||||
$c->app->log->warn( Dumper $error );
|
||||
}
|
||||
else {
|
||||
$c->flash( success => 'Updated User' );
|
||||
|
|
|
@ -460,14 +460,16 @@ sub post_leaderboards {
|
|||
my @leaderboard_array = $today_values->all;
|
||||
|
||||
if ( $validation->param('type') =~ /total$/ ) {
|
||||
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
|
||||
@leaderboard_array = (
|
||||
map {
|
||||
{
|
||||
%$_,
|
||||
value => $_->{value} / 100000,
|
||||
value => $_->{value} / 100000
|
||||
}
|
||||
} @leaderboard_array
|
||||
);
|
||||
## use critic
|
||||
}
|
||||
|
||||
my $current_user_position =
|
||||
|
@ -543,6 +545,7 @@ sub post_leaderboards_paged {
|
|||
$values_count = $today_values->pager->total_entries;
|
||||
|
||||
if ( $validation->param('type') =~ /total$/ ) {
|
||||
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
|
||||
@leaderboard_array = (
|
||||
map {
|
||||
{
|
||||
|
@ -551,6 +554,7 @@ sub post_leaderboards_paged {
|
|||
}
|
||||
} @leaderboard_array
|
||||
);
|
||||
## use critic
|
||||
}
|
||||
|
||||
$current_user_position = $today_values->find(
|
||||
|
|
|
@ -34,3 +34,5 @@ __PACKAGE__->set_primary_key("id");
|
|||
|
||||
__PACKAGE__->belongs_to( "entity", "Pear::LocalLoop::Schema::Result::Entity",
|
||||
"entity_id", );
|
||||
|
||||
1;
|
||||
|
|
|
@ -5,7 +5,9 @@ use warnings;
|
|||
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
## no critic (Subroutines::RequireArgUnpacking)
|
||||
sub sales { return shift->search_related( 'sales', @_ ) }
|
||||
## use critic
|
||||
|
||||
sub create_org {
|
||||
my ( $self, $org ) = @_;
|
||||
|
@ -16,8 +18,6 @@ sub create_org {
|
|||
type => 'organisation',
|
||||
}
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -39,9 +39,9 @@ sub _unordered_get_values {
|
|||
}
|
||||
|
||||
sub get_users {
|
||||
my $self = shift;
|
||||
my ($self, $set_id) = @_;
|
||||
|
||||
return $self->_unordered_get_values(@_)->search(
|
||||
return $self->_unordered_get_values($set_id)->search(
|
||||
{},
|
||||
{
|
||||
group_by => 'user_name',
|
||||
|
@ -51,9 +51,9 @@ sub get_users {
|
|||
}
|
||||
|
||||
sub get_orgs {
|
||||
my $self = shift;
|
||||
my ( $self, $set_id ) = shift;
|
||||
|
||||
return $self->_unordered_get_values(@_)->search(
|
||||
return $self->_unordered_get_values($set_id)->search(
|
||||
{},
|
||||
{
|
||||
group_by => 'org_name',
|
||||
|
|
|
@ -5,6 +5,8 @@ use warnings;
|
|||
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
## no critic (Subroutines::RequireArgUnpacking)
|
||||
sub entity { return shift->search_related( 'entity', @_ ) }
|
||||
## use critic
|
||||
|
||||
1;
|
||||
|
|
|
@ -69,7 +69,7 @@ has mojo => (
|
|||
builder => sub {
|
||||
my $self = shift;
|
||||
|
||||
$ENV{MOJO_CONFIG} = $self->config->filename;
|
||||
local $ENV{MOJO_CONFIG} = $self->config->filename;
|
||||
|
||||
my $t = Test::Mojo->new('Pear::LocalLoop');
|
||||
$t->app->schema->deploy;
|
||||
|
@ -197,8 +197,6 @@ sub gen_upload {
|
|||
json => Mojo::JSON::encode_json($args),
|
||||
file => $file,
|
||||
};
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub install_fixtures {
|
||||
|
|
Reference in a new issue