line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
12388
|
use utf8; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
68
|
|
2
|
|
|
|
|
|
|
package CPAN::Testers::Schema::ResultSet::Release; |
3
|
|
|
|
|
|
|
our $VERSION = '0.025'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Query the per-release summary testers data |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
7
|
|
|
|
|
|
|
#pod |
8
|
|
|
|
|
|
|
#pod my $rs = $schema->resultset( 'Release' ); |
9
|
|
|
|
|
|
|
#pod $rs->by_dist( 'My-Dist', '0.001' ); |
10
|
|
|
|
|
|
|
#pod $rs->by_author( 'PREACTION' ); |
11
|
|
|
|
|
|
|
#pod $rs->since( '2016-01-01T00:00:00' ); |
12
|
|
|
|
|
|
|
#pod $rs->maturity( 'stable' ); |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod This object helps to query the per-release test report summaries. These |
17
|
|
|
|
|
|
|
#pod summaries say how many pass, fail, NA, and unknown results a single |
18
|
|
|
|
|
|
|
#pod version of a distribution has. |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod L<DBIx::Class::ResultSet>, L<CPAN::Testers::Schema> |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =cut |
25
|
|
|
|
|
|
|
|
26
|
13
|
|
|
13
|
|
725
|
use CPAN::Testers::Schema::Base 'ResultSet'; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
68
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#pod =method by_dist |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod $rs = $rs->by_dist( 'My-Dist' ); |
31
|
|
|
|
|
|
|
#pod $rs = $rs->by_dist( 'My-Dist', '0.001' ); |
32
|
|
|
|
|
|
|
#pod |
33
|
|
|
|
|
|
|
#pod Add a dist constraint to the query (with optional version), replacing |
34
|
|
|
|
|
|
|
#pod any previous dist constraints. |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =cut |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
4
|
1
|
33956
|
sub by_dist( $self, $dist, $version = undef ) { |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
7
|
|
39
|
4
|
|
|
|
|
12
|
my %search = ( 'me.dist' => $dist ); |
40
|
4
|
100
|
|
|
|
12
|
if ( $version ) { |
41
|
1
|
|
|
|
|
3
|
$search{ 'me.version' } = $version; |
42
|
|
|
|
|
|
|
} |
43
|
4
|
|
|
|
|
11
|
return $self->search( \%search ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#pod =method by_author |
47
|
|
|
|
|
|
|
#pod |
48
|
|
|
|
|
|
|
#pod $rs = $rs->by_author( 'PREACTION' ); |
49
|
|
|
|
|
|
|
#pod |
50
|
|
|
|
|
|
|
#pod Add an author constraint to the query, replacing any previous author |
51
|
|
|
|
|
|
|
#pod constraints. |
52
|
|
|
|
|
|
|
#pod |
53
|
|
|
|
|
|
|
#pod =cut |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
3
|
1
|
30887
|
sub by_author( $self, $author ) { |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
5
|
|
56
|
3
|
|
|
|
|
13
|
return $self->search( { 'upload.author' => $author }, { join => 'upload' } ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#pod =method since |
60
|
|
|
|
|
|
|
#pod |
61
|
|
|
|
|
|
|
#pod $rs = $rs->since( '2016-01-01T00:00:00' ); |
62
|
|
|
|
|
|
|
#pod |
63
|
|
|
|
|
|
|
#pod Restrict results to only those that have been updated since the given |
64
|
|
|
|
|
|
|
#pod ISO8601 date. |
65
|
|
|
|
|
|
|
#pod |
66
|
|
|
|
|
|
|
#pod =cut |
67
|
|
|
|
|
|
|
|
68
|
4
|
|
|
4
|
1
|
640357
|
sub since( $self, $date ) { |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
4
|
|
69
|
4
|
|
|
|
|
23
|
my $fulldate = $date =~ s/[-:T]//gr; |
70
|
4
|
|
|
|
|
9
|
$fulldate = substr $fulldate, 0, 12; # 12 digits makes YYYYMMDDHHNN |
71
|
4
|
|
|
|
|
27
|
return $self->search( { 'report.fulldate' => { '>=', $fulldate } }, { join => 'report' } ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#pod =method maturity |
75
|
|
|
|
|
|
|
#pod |
76
|
|
|
|
|
|
|
#pod $rs = $rs->maturity( 'stable' ); |
77
|
|
|
|
|
|
|
#pod |
78
|
|
|
|
|
|
|
#pod Restrict results to only those dists that are stable. Also supported: |
79
|
|
|
|
|
|
|
#pod 'dev' to restrict to only development dists. |
80
|
|
|
|
|
|
|
#pod |
81
|
|
|
|
|
|
|
#pod =cut |
82
|
|
|
|
|
|
|
|
83
|
5
|
|
|
5
|
1
|
20550
|
sub maturity( $self, $maturity ) { |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
7
|
|
84
|
5
|
|
|
|
|
18
|
my %map = ( 'stable' => 1, 'dev' => 2 ); |
85
|
5
|
|
|
|
|
11
|
$maturity = $map{ $maturity }; |
86
|
5
|
|
|
|
|
18
|
return $self->search( { 'me.distmat' => $maturity } ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#pod =method total_by_release |
90
|
|
|
|
|
|
|
#pod |
91
|
|
|
|
|
|
|
#pod $rs = $rs->total_by_release |
92
|
|
|
|
|
|
|
#pod |
93
|
|
|
|
|
|
|
#pod Sum the pass/fail/na/unknown counts by release distribution and version. |
94
|
|
|
|
|
|
|
#pod |
95
|
|
|
|
|
|
|
#pod =cut |
96
|
|
|
|
|
|
|
|
97
|
2
|
|
|
2
|
1
|
42923
|
sub total_by_release( $self ) { |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5
|
|
98
|
2
|
|
|
|
|
9
|
my @total_cols = qw( pass fail na unknown ); |
99
|
2
|
|
|
|
|
17
|
my $me = $self->current_source_alias; |
100
|
|
|
|
|
|
|
return $self->search( {}, { |
101
|
|
|
|
|
|
|
# The uploadid here is included to allow joins from the results |
102
|
|
|
|
|
|
|
group_by => [ map "$me.$_", qw( dist version uploadid ) ], |
103
|
|
|
|
|
|
|
select => [ |
104
|
|
|
|
|
|
|
qw( dist version uploadid ), |
105
|
2
|
|
|
|
|
21
|
( map { \"SUM($_) AS $_" } @total_cols ), |
|
8
|
|
|
|
|
36
|
|
106
|
|
|
|
|
|
|
( \sprintf 'SUM(%s) AS total', join ' + ', @total_cols ) |
107
|
|
|
|
|
|
|
], |
108
|
|
|
|
|
|
|
as => [ qw( dist version uploadid ), @total_cols, 'total' ], |
109
|
|
|
|
|
|
|
order_by => undef, |
110
|
|
|
|
|
|
|
} ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=pod |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 NAME |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
CPAN::Testers::Schema::ResultSet::Release - Query the per-release summary testers data |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 VERSION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
version 0.025 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 SYNOPSIS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my $rs = $schema->resultset( 'Release' ); |
130
|
|
|
|
|
|
|
$rs->by_dist( 'My-Dist', '0.001' ); |
131
|
|
|
|
|
|
|
$rs->by_author( 'PREACTION' ); |
132
|
|
|
|
|
|
|
$rs->since( '2016-01-01T00:00:00' ); |
133
|
|
|
|
|
|
|
$rs->maturity( 'stable' ); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 DESCRIPTION |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This object helps to query the per-release test report summaries. These |
138
|
|
|
|
|
|
|
summaries say how many pass, fail, NA, and unknown results a single |
139
|
|
|
|
|
|
|
version of a distribution has. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 METHODS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 by_dist |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
$rs = $rs->by_dist( 'My-Dist' ); |
146
|
|
|
|
|
|
|
$rs = $rs->by_dist( 'My-Dist', '0.001' ); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Add a dist constraint to the query (with optional version), replacing |
149
|
|
|
|
|
|
|
any previous dist constraints. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 by_author |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$rs = $rs->by_author( 'PREACTION' ); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Add an author constraint to the query, replacing any previous author |
156
|
|
|
|
|
|
|
constraints. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 since |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
$rs = $rs->since( '2016-01-01T00:00:00' ); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Restrict results to only those that have been updated since the given |
163
|
|
|
|
|
|
|
ISO8601 date. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 maturity |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$rs = $rs->maturity( 'stable' ); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Restrict results to only those dists that are stable. Also supported: |
170
|
|
|
|
|
|
|
'dev' to restrict to only development dists. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 total_by_release |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
$rs = $rs->total_by_release |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Sum the pass/fail/na/unknown counts by release distribution and version. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 SEE ALSO |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
L<DBIx::Class::ResultSet>, L<CPAN::Testers::Schema> |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 AUTHORS |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=over 4 |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Oriol Soriano <oriolsoriano@gmail.com> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Doug Bell <preaction@cpan.org> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=back |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Oriol Soriano, Doug Bell. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
201
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |