File Coverage

blib/lib/Perl5/CoreSmokeDB/Schema/Result/Result.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition n/a
subroutine 4 6 66.6
pod 1 2 50.0
total 17 33 51.5


line stmt bran cond sub pod time code
1 3     3   1405 use utf8;
  3         7  
  3         14  
2              
3             # Created by DBIx::Class::Schema::Loader
4             # DO NOT MODIFY THE FIRST PART OF THIS FILE
5              
6             =head1 NAME
7              
8             Perl5::CoreSmokeDB::Schema::Result::Result
9              
10             =cut
11              
12             use strict;
13 3     3   109 use warnings;
  3         7  
  3         63  
14 3     3   12  
  3         6  
  3         70  
15             use base 'DBIx::Class::Core';
16 3     3   13  
  3         5  
  3         1091  
17             =head1 COMPONENTS LOADED
18              
19             =over 4
20              
21             =item * L<DBIx::Class::InflateColumn::DateTime>
22              
23             =back
24              
25             =cut
26              
27             __PACKAGE__->load_components("InflateColumn::DateTime");
28              
29             =head1 TABLE: C<result>
30              
31             =cut
32              
33             __PACKAGE__->table("result");
34              
35             =head1 ACCESSORS
36              
37             =head2 id
38              
39             data_type: 'integer'
40             is_auto_increment: 1
41             is_nullable: 0
42             sequence: 'result_id_seq'
43              
44             =head2 config_id
45              
46             data_type: 'integer'
47             is_foreign_key: 1
48             is_nullable: 0
49              
50             =head2 io_env
51              
52             data_type: 'text'
53             is_nullable: 0
54             original: {data_type => "varchar"}
55              
56             =head2 locale
57              
58             data_type: 'text'
59             is_nullable: 1
60             original: {data_type => "varchar"}
61              
62             =head2 summary
63              
64             data_type: 'text'
65             is_nullable: 0
66             original: {data_type => "varchar"}
67              
68             =head2 statistics
69              
70             data_type: 'text'
71             is_nullable: 1
72             original: {data_type => "varchar"}
73              
74             =head2 stat_cpu_time
75              
76             data_type: 'double precision'
77             is_nullable: 1
78              
79             =head2 stat_tests
80              
81             data_type: 'integer'
82             is_nullable: 1
83              
84             =cut
85              
86             __PACKAGE__->add_columns(
87             "id",
88             {
89             data_type => "integer",
90             is_auto_increment => 1,
91             is_nullable => 0,
92             sequence => "result_id_seq",
93             },
94             "config_id",
95             { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
96             "io_env",
97             {
98             data_type => "text",
99             is_nullable => 0,
100             original => { data_type => "varchar" },
101             },
102             "locale",
103             {
104             data_type => "text",
105             is_nullable => 1,
106             original => { data_type => "varchar" },
107             },
108             "summary",
109             {
110             data_type => "text",
111             is_nullable => 0,
112             original => { data_type => "varchar" },
113             },
114             "statistics",
115             {
116             data_type => "text",
117             is_nullable => 1,
118             original => { data_type => "varchar" },
119             },
120             "stat_cpu_time",
121             { data_type => "double precision", is_nullable => 1 },
122             "stat_tests",
123             { data_type => "integer", is_nullable => 1 },
124             );
125              
126             =head1 PRIMARY KEY
127              
128             =over 4
129              
130             =item * L</id>
131              
132             =back
133              
134             =cut
135              
136             __PACKAGE__->set_primary_key("id");
137              
138             =head1 RELATIONS
139              
140             =head2 config
141              
142             Type: belongs_to
143              
144             Related object: L<Perl5::CoreSmokeDB::Schema::Result::Config>
145              
146             =cut
147              
148             __PACKAGE__->belongs_to(
149             "config",
150             "Perl5::CoreSmokeDB::Schema::Result::Config",
151             { id => "config_id" },
152             { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
153             );
154              
155             =head2 failures_for_env
156              
157             Type: has_many
158              
159             Related object: L<Perl5::CoreSmokeDB::Schema::Result::FailureForEnv>
160              
161             =cut
162              
163             __PACKAGE__->has_many(
164             "failures_for_env",
165             "Perl5::CoreSmokeDB::Schema::Result::FailureForEnv",
166             { "foreign.result_id" => "self.id" },
167             { cascade_copy => 0, cascade_delete => 0 },
168             );
169              
170              
171             # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-06 09:15:22
172             # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5lE0GqaccBSQy5zLROkITw
173              
174             my $self = shift;
175             return $self->locale
176 0     0 0   ? join(":", $self->io_env, $self->locale)
177 0 0         : $self->io_env;
178             }
179              
180             =head2 $record->as_hashref([$is_full])
181              
182             Returns a HashRef with the inflated columns.
183              
184             =head3 Parameters
185              
186             Positional:
187              
188             =over
189              
190             =item 1. C<'full'>
191              
192             If the word C<full> is passed as the first argument the related
193             C<failures_for_env> are also included in the resulting HashRef.
194              
195             =back
196              
197             =cut
198              
199             my $self = shift;
200             my ($is_full) = @_;
201              
202 0     0 1   my $record = { $self->get_inflated_columns };
203 0            
204             if ($is_full eq 'full') {
205 0           $record->{failures} = [ map { $_->as_hashref($is_full) } $self->failures_for_env ];
206             }
207 0 0          
208 0           return $record;
  0            
209             }
210              
211 0           1;