]> iEval git - gruntmaster-data.git/blame_incremental - lib/Gruntmaster/Data/Result/Problem.pm
Add a purge sub and use it in gruntmaster-*
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Problem.pm
... / ...
CommitLineData
1use utf8;
2package Gruntmaster::Data::Result::Problem;
3
4# Created by DBIx::Class::Schema::Loader
5# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7=head1 NAME
8
9Gruntmaster::Data::Result::Problem
10
11=cut
12
13use strict;
14use warnings;
15
16use base 'DBIx::Class::Core';
17
18=head1 TABLE: C<problems>
19
20=cut
21
22__PACKAGE__->table("problems");
23
24=head1 ACCESSORS
25
26=head2 id
27
28 data_type: 'text'
29 is_nullable: 0
30
31=head2 author
32
33 data_type: 'text'
34 is_nullable: 1
35
36=head2 writer
37
38 data_type: 'text'
39 is_nullable: 1
40
41=head2 generator
42
43 data_type: 'text'
44 is_nullable: 0
45
46=head2 judge
47
48 data_type: 'text'
49 is_nullable: 0
50
51=head2 level
52
53 data_type: 'text'
54 is_nullable: 0
55
56=head2 name
57
58 data_type: 'text'
59 is_nullable: 0
60
61=head2 olimit
62
63 data_type: 'integer'
64 is_nullable: 1
65
66=head2 owner
67
68 data_type: 'text'
69 is_foreign_key: 1
70 is_nullable: 0
71
72=head2 private
73
74 data_type: 'boolean'
75 default_value: false
76 is_nullable: 0
77
78=head2 runner
79
80 data_type: 'text'
81 is_nullable: 0
82
83=head2 solution
84
85 data_type: 'text'
86 is_nullable: 1
87
88=head2 statement
89
90 data_type: 'text'
91 is_nullable: 0
92
93=head2 testcnt
94
95 data_type: 'integer'
96 is_nullable: 0
97
98=head2 tests
99
100 data_type: 'text'
101 is_nullable: 1
102
103=head2 timeout
104
105 data_type: 'real'
106 is_nullable: 0
107
108=head2 value
109
110 data_type: 'integer'
111 is_nullable: 0
112
113=head2 genformat
114
115 data_type: 'text'
116 is_nullable: 1
117
118=head2 gensource
119
120 data_type: 'text'
121 is_nullable: 1
122
123=head2 verformat
124
125 data_type: 'text'
126 is_nullable: 1
127
128=head2 versource
129
130 data_type: 'text'
131 is_nullable: 1
132
133=cut
134
135__PACKAGE__->add_columns(
136 "id",
137 { data_type => "text", is_nullable => 0 },
138 "author",
139 { data_type => "text", is_nullable => 1 },
140 "writer",
141 { data_type => "text", is_nullable => 1 },
142 "generator",
143 { data_type => "text", is_nullable => 0 },
144 "judge",
145 { data_type => "text", is_nullable => 0 },
146 "level",
147 { data_type => "text", is_nullable => 0 },
148 "name",
149 { data_type => "text", is_nullable => 0 },
150 "olimit",
151 { data_type => "integer", is_nullable => 1 },
152 "owner",
153 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
154 "private",
155 { data_type => "boolean", default_value => \"false", is_nullable => 0 },
156 "runner",
157 { data_type => "text", is_nullable => 0 },
158 "solution",
159 { data_type => "text", is_nullable => 1 },
160 "statement",
161 { data_type => "text", is_nullable => 0 },
162 "testcnt",
163 { data_type => "integer", is_nullable => 0 },
164 "tests",
165 { data_type => "text", is_nullable => 1 },
166 "timeout",
167 { data_type => "real", is_nullable => 0 },
168 "value",
169 { data_type => "integer", is_nullable => 0 },
170 "genformat",
171 { data_type => "text", is_nullable => 1 },
172 "gensource",
173 { data_type => "text", is_nullable => 1 },
174 "verformat",
175 { data_type => "text", is_nullable => 1 },
176 "versource",
177 { data_type => "text", is_nullable => 1 },
178);
179
180=head1 PRIMARY KEY
181
182=over 4
183
184=item * L</id>
185
186=back
187
188=cut
189
190__PACKAGE__->set_primary_key("id");
191
192=head1 RELATIONS
193
194=head2 contest_problems
195
196Type: has_many
197
198Related object: L<Gruntmaster::Data::Result::ContestProblem>
199
200=cut
201
202__PACKAGE__->has_many(
203 "contest_problems",
204 "Gruntmaster::Data::Result::ContestProblem",
205 { "foreign.problem" => "self.id" },
206 { cascade_copy => 0, cascade_delete => 0 },
207);
208
209=head2 jobs
210
211Type: has_many
212
213Related object: L<Gruntmaster::Data::Result::Job>
214
215=cut
216
217__PACKAGE__->has_many(
218 "jobs",
219 "Gruntmaster::Data::Result::Job",
220 { "foreign.problem" => "self.id" },
221 { cascade_copy => 0, cascade_delete => 0 },
222);
223
224=head2 opens
225
226Type: has_many
227
228Related object: L<Gruntmaster::Data::Result::Open>
229
230=cut
231
232__PACKAGE__->has_many(
233 "opens",
234 "Gruntmaster::Data::Result::Open",
235 { "foreign.problem" => "self.id" },
236 { cascade_copy => 0, cascade_delete => 0 },
237);
238
239=head2 owner
240
241Type: belongs_to
242
243Related object: L<Gruntmaster::Data::Result::User>
244
245=cut
246
247__PACKAGE__->belongs_to(
248 "owner",
249 "Gruntmaster::Data::Result::User",
250 { id => "owner" },
251 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
252);
253
254=head2 problem_statuses
255
256Type: has_many
257
258Related object: L<Gruntmaster::Data::Result::ProblemStatus>
259
260=cut
261
262__PACKAGE__->has_many(
263 "problem_statuses",
264 "Gruntmaster::Data::Result::ProblemStatus",
265 { "foreign.problem" => "self.id" },
266 { cascade_copy => 0, cascade_delete => 0 },
267);
268
269=head2 contests
270
271Type: many_to_many
272
273Composing rels: L</contest_problems> -> contest
274
275=cut
276
277__PACKAGE__->many_to_many("contests", "contest_problems", "contest");
278
279
280# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-11 23:51:27
281# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1SnNCeJdFr5lM3mmO6rtqA
282
283sub is_private {
284 my ($self, $time) = @_;
285 return 1 if $self->private;
286 grep { $_->contest->is_pending($time) } $self->contest_problems;
287}
288
289sub is_in_archive {
290 my ($self, $time) = @_;
291 0 == grep { $_->contest->is_running($time) } $self->contest_problems;
292}
293
294sub rerun {
295 $_->rerun for shift->jobs
296}
297
2981;
299
300__END__
301
302=head1 METHODS
303
304=head2 is_private(I<[$time]>)
305
306Returns true if the problem is private at time I<$time> (which defaults to C<time>).
307
308=head2 is_in_archive(I<[$time]>)
309
310Returns true if the problem is in the archive at time I<$time> (which defaults to C<time>).
311
312=head2 rerun
313
314Reruns all jobs for this problem.
315
316=head1 AUTHOR
317
318Marius Gavrilescu E<lt>marius@ieval.roE<gt>
319
320=head1 COPYRIGHT AND LICENSE
321
322Copyright (C) 2014 by Marius Gavrilescu
323
324This library is free software; you can redistribute it and/or modify
325it under the same terms as Perl itself, either Perl version 5.18.1 or,
326at your option, any later version of Perl 5 you may have available.
327
328
329=cut
This page took 0.023088 seconds and 4 git commands to generate.