line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::log::hub; |
2
|
1
|
|
|
1
|
|
5332
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use feature 'state'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
89
|
|
5
|
1
|
|
|
1
|
|
5
|
use locale; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
26
|
use Bif::Mo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.1.5_7'; |
9
|
|
|
|
|
|
|
extends 'App::bif::log'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
13
|
1
|
|
|
|
|
5
|
my $opts = $self->opts; |
14
|
1
|
|
|
|
|
8
|
my $db = $self->db; |
15
|
|
|
|
|
|
|
my $hub = |
16
|
|
|
|
|
|
|
$opts->{id} |
17
|
|
|
|
|
|
|
? $self->get_hub( $opts->{id} ) |
18
|
0
|
0
|
|
|
|
|
: $self->get_hub( $opts->{name} ); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my ( $dark, $reset ) = $self->colours(qw/dark reset/); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $sth = $db->xprepare( |
23
|
|
|
|
|
|
|
select => [ |
24
|
|
|
|
|
|
|
q{strftime('%w',c.mtime,'unixepoch','localtime') AS weekday}, |
25
|
|
|
|
|
|
|
q{strftime('%Y-%m-%d',c.mtime,'unixepoch','localtime') AS mdate}, |
26
|
|
|
|
|
|
|
q{strftime('%H:%M:%S',c.mtime,'unixepoch','localtime') AS mtime}, |
27
|
|
|
|
|
|
|
'c.action', |
28
|
|
|
|
|
|
|
], |
29
|
|
|
|
|
|
|
from => 'hub_deltas hd', |
30
|
|
|
|
|
|
|
inner_join => 'changes c', |
31
|
|
|
|
|
|
|
on => 'c.id = hd.change_id', |
32
|
|
|
|
|
|
|
where => { 'hd.hub_id' => $hub->{id} }, |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# group_by => [qw/weekday mdate mtime/], |
35
|
0
|
|
|
|
|
|
order_by => 'c.id DESC', |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$sth->execute; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->start_pager; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my @days = ( |
43
|
|
|
|
|
|
|
qw/Sunday Monday Tuesday Wednesday Thursday Friday |
44
|
|
|
|
|
|
|
Saturday/ |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $first = $sth->arrayref; |
48
|
0
|
|
|
|
|
|
my $weekday = $first->[0]; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
print " $dark$first->[1] ($days[$weekday]) $reset \n"; |
51
|
0
|
|
|
|
|
|
print '-' x 80, "\n"; |
52
|
0
|
|
|
|
|
|
print " $first->[2] $first->[3]\n"; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
while ( my $n = $sth->arrayref ) { |
55
|
0
|
0
|
|
|
|
|
if ( $n->[0] != $weekday ) { |
56
|
0
|
|
|
|
|
|
print "\n $dark$n->[1] ($days[ $n->[0] ])$reset\n"; |
57
|
0
|
|
|
|
|
|
print '-' x 80, "\n"; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
print " $n->[2] $n->[3]\n"; |
61
|
0
|
|
|
|
|
|
$weekday = $n->[0]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return $self->ok('LogHub'); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
__END__ |