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