Bracket

 view release on metacpan or  search on metacpan

lib/Bracket/Controller/Admin.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    # Restrict controller to admin role
    my @user_roles = $c->user->roles;
 
    if (!$c->stash->{is_admin}) {
        $c->go('/error_404');
        return 0;
    }
    else { return 1; }
}
 
sub update_player_points : Global {
    my ($self, $c) = @_;
 
    $c->stash->{template} = 'player/all_home.tt';
    my @players = $c->model('DBIC::Player')->all;
 
    # Get player scores
    foreach my $player (@players) {
 
        # Avoid non active players
        next if $player->active == 0;

lib/Bracket/Controller/Admin.pm  view on Meta::CPAN

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
}
 
# Quality Assurance to check that lower seeds are marked correctly.
sub qa : Global {
    my ($self, $c) = @_;
    my @played_games = $c->model('DBIC::Pick')->search({ player => 1 }, { order_by => 'game' });
    $c->stash->{played_games} = \@played_games;
    $c->stash->{template}     = 'admin/lower_seeds.tt';
}
 
sub update_points : Global {
    my ($self, $c) = @_;
    my @points = $c->model('DBIC')->update_points;
    $c->flash->{status_msg} = 'Scores Updated';
    $c->response->redirect($c->uri_for($c->controller('Player')->action_for('all')));
    return;
}
 
=head2 round_out
 
Mark the round teams go out.

lib/Bracket/Form/Password/ResetEmail.pm  view on Meta::CPAN

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
          ->find( { email => $self->field('email')->value } );
        if ( !$is_valid ) {
                $self->field('email')->add_error('Email not on file');
        }
         
        return;
}
 
# Turn off update_model
 
sub update_model {}
 
no HTML::FormHandler::Moose;
__PACKAGE__->meta->make_immutable;
1

lib/Bracket/Model/DBIC.pm  view on Meta::CPAN

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
=head2 update_points
 
SQL update of points that is way faster than player_points action in Admin.
DRAWBACK: only tested on MySQL, may be MySQL specfic update.
SOLUTION: Find DBIC way of doing it?  Use sub-query.
 
Note: sqlite3 does not like the syntax on this update
 
=cut
 
sub update_points {
    my $self    = shift;
    my $storage = $self->schema->storage;
    return $storage->dbh_do(
        sub {
            my $self = shift;
            my $dbh  = shift;
            my $sth  = $dbh->prepare('delete from region_score;');
            $sth->execute;
            $sth = $dbh->prepare('
                insert into region_score



( run in 0.581 second using v1.01-cache-2.11-cpan-49f99fa48dc )