]>
Commit | Line | Data |
---|---|---|
4ed3f8e7 MG |
1 | use utf8; |
2 | package 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 | ||
be2f7678 | 9 | Gruntmaster::Data::Result::Problem - List of problems |
4ed3f8e7 MG |
10 | |
11 | =cut | |
12 | ||
13 | use strict; | |
14 | use warnings; | |
15 | ||
16 | use 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' | |
85d3f015 | 34 | is_nullable: 1 |
4ed3f8e7 | 35 | |
be2f7678 MG |
36 | Full name(s) of problem author(s)/problemsetter(s)/tester(s)/etc |
37 | ||
6a03bf0d MG |
38 | =head2 writer |
39 | ||
40 | data_type: 'text' | |
41 | is_nullable: 1 | |
42 | ||
be2f7678 MG |
43 | Full name(s) of statement writer(s) (DEPRECATED) |
44 | ||
4ed3f8e7 MG |
45 | =head2 generator |
46 | ||
9bb39921 | 47 | data_type: 'text' |
4ed3f8e7 MG |
48 | is_nullable: 0 |
49 | ||
be2f7678 MG |
50 | Generator class, without the leading Gruntmaster::Daemon::Generator:: |
51 | ||
4ed3f8e7 MG |
52 | =head2 judge |
53 | ||
9bb39921 | 54 | data_type: 'text' |
4ed3f8e7 MG |
55 | is_nullable: 0 |
56 | ||
be2f7678 MG |
57 | Judge class, without the leading Gruntmaster::Daemon::Judge:: |
58 | ||
4ed3f8e7 MG |
59 | =head2 level |
60 | ||
9bb39921 | 61 | data_type: 'text' |
4ed3f8e7 MG |
62 | is_nullable: 0 |
63 | ||
be2f7678 MG |
64 | Problem level, one of beginner, easy, medium, hard |
65 | ||
4ed3f8e7 MG |
66 | =head2 name |
67 | ||
68 | data_type: 'text' | |
69 | is_nullable: 0 | |
70 | ||
71 | =head2 olimit | |
72 | ||
73 | data_type: 'integer' | |
74 | is_nullable: 1 | |
75 | ||
be2f7678 MG |
76 | Output limit (in bytes) |
77 | ||
4ed3f8e7 MG |
78 | =head2 owner |
79 | ||
80 | data_type: 'text' | |
81 | is_foreign_key: 1 | |
82 | is_nullable: 0 | |
83 | ||
84 | =head2 private | |
85 | ||
86 | data_type: 'boolean' | |
b2725d9d | 87 | default_value: false |
4ed3f8e7 MG |
88 | is_nullable: 0 |
89 | ||
90 | =head2 runner | |
91 | ||
9bb39921 | 92 | data_type: 'text' |
4ed3f8e7 MG |
93 | is_nullable: 0 |
94 | ||
be2f7678 MG |
95 | Runner class, without the leading Gruntmaster::Daemon::Runner:: |
96 | ||
1980106a MG |
97 | =head2 solution |
98 | ||
99 | data_type: 'text' | |
100 | is_nullable: 1 | |
101 | ||
be2f7678 MG |
102 | Solution (HTML) |
103 | ||
4ed3f8e7 MG |
104 | =head2 statement |
105 | ||
106 | data_type: 'text' | |
107 | is_nullable: 0 | |
108 | ||
be2f7678 MG |
109 | Statement (HTML) |
110 | ||
4ed3f8e7 MG |
111 | =head2 testcnt |
112 | ||
113 | data_type: 'integer' | |
114 | is_nullable: 0 | |
115 | ||
be2f7678 MG |
116 | Number of tests |
117 | ||
f7c095d3 MG |
118 | =head2 precnt |
119 | ||
120 | data_type: 'integer' | |
121 | is_nullable: 1 | |
122 | ||
123 | Number of pretests. NULL indicates full feedback. | |
124 | ||
b2725d9d MG |
125 | =head2 tests |
126 | ||
127 | data_type: 'text' | |
128 | is_nullable: 1 | |
129 | ||
be2f7678 MG |
130 | JSON array of test values for ::Runner::File |
131 | ||
4ed3f8e7 MG |
132 | =head2 timeout |
133 | ||
134 | data_type: 'real' | |
135 | is_nullable: 0 | |
136 | ||
be2f7678 MG |
137 | Time limit (in seconds) |
138 | ||
4ed3f8e7 MG |
139 | =head2 value |
140 | ||
141 | data_type: 'integer' | |
aaa9eb7d | 142 | is_nullable: 0 |
4ed3f8e7 | 143 | |
be2f7678 MG |
144 | Problem value when used in a contest. |
145 | ||
85d3f015 MG |
146 | =head2 genformat |
147 | ||
148 | data_type: 'text' | |
149 | is_nullable: 1 | |
150 | ||
be2f7678 MG |
151 | Format (programming language) of the generator if using the Run generator |
152 | ||
85d3f015 MG |
153 | =head2 gensource |
154 | ||
155 | data_type: 'text' | |
156 | is_nullable: 1 | |
157 | ||
be2f7678 MG |
158 | Source code of generator if using the Run generator |
159 | ||
4ed3f8e7 MG |
160 | =head2 verformat |
161 | ||
162 | data_type: 'text' | |
163 | is_nullable: 1 | |
164 | ||
be2f7678 MG |
165 | Format (programming language) of the verifier if using the Verifier runner |
166 | ||
4ed3f8e7 MG |
167 | =head2 versource |
168 | ||
169 | data_type: 'text' | |
170 | is_nullable: 1 | |
171 | ||
be2f7678 MG |
172 | Source code of verifier if using the Verifier runner |
173 | ||
4ed3f8e7 MG |
174 | =cut |
175 | ||
176 | __PACKAGE__->add_columns( | |
177 | "id", | |
178 | { data_type => "text", is_nullable => 0 }, | |
179 | "author", | |
85d3f015 | 180 | { data_type => "text", is_nullable => 1 }, |
6a03bf0d MG |
181 | "writer", |
182 | { data_type => "text", is_nullable => 1 }, | |
4ed3f8e7 | 183 | "generator", |
9bb39921 | 184 | { data_type => "text", is_nullable => 0 }, |
4ed3f8e7 | 185 | "judge", |
9bb39921 | 186 | { data_type => "text", is_nullable => 0 }, |
4ed3f8e7 | 187 | "level", |
9bb39921 | 188 | { data_type => "text", is_nullable => 0 }, |
4ed3f8e7 MG |
189 | "name", |
190 | { data_type => "text", is_nullable => 0 }, | |
191 | "olimit", | |
192 | { data_type => "integer", is_nullable => 1 }, | |
193 | "owner", | |
194 | { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, | |
195 | "private", | |
b2725d9d | 196 | { data_type => "boolean", default_value => \"false", is_nullable => 0 }, |
4ed3f8e7 | 197 | "runner", |
9bb39921 | 198 | { data_type => "text", is_nullable => 0 }, |
1980106a MG |
199 | "solution", |
200 | { data_type => "text", is_nullable => 1 }, | |
4ed3f8e7 MG |
201 | "statement", |
202 | { data_type => "text", is_nullable => 0 }, | |
203 | "testcnt", | |
204 | { data_type => "integer", is_nullable => 0 }, | |
f7c095d3 MG |
205 | "precnt", |
206 | { data_type => "integer", is_nullable => 1 }, | |
b2725d9d MG |
207 | "tests", |
208 | { data_type => "text", is_nullable => 1 }, | |
4ed3f8e7 MG |
209 | "timeout", |
210 | { data_type => "real", is_nullable => 0 }, | |
211 | "value", | |
aaa9eb7d | 212 | { data_type => "integer", is_nullable => 0 }, |
85d3f015 MG |
213 | "genformat", |
214 | { data_type => "text", is_nullable => 1 }, | |
215 | "gensource", | |
216 | { data_type => "text", is_nullable => 1 }, | |
4ed3f8e7 MG |
217 | "verformat", |
218 | { data_type => "text", is_nullable => 1 }, | |
219 | "versource", | |
220 | { data_type => "text", is_nullable => 1 }, | |
221 | ); | |
222 | ||
223 | =head1 PRIMARY KEY | |
224 | ||
225 | =over 4 | |
226 | ||
227 | =item * L</id> | |
228 | ||
229 | =back | |
230 | ||
231 | =cut | |
232 | ||
233 | __PACKAGE__->set_primary_key("id"); | |
234 | ||
235 | =head1 RELATIONS | |
236 | ||
237 | =head2 contest_problems | |
238 | ||
239 | Type: has_many | |
240 | ||
241 | Related object: L<Gruntmaster::Data::Result::ContestProblem> | |
242 | ||
243 | =cut | |
244 | ||
245 | __PACKAGE__->has_many( | |
246 | "contest_problems", | |
247 | "Gruntmaster::Data::Result::ContestProblem", | |
248 | { "foreign.problem" => "self.id" }, | |
249 | { cascade_copy => 0, cascade_delete => 0 }, | |
250 | ); | |
251 | ||
252 | =head2 jobs | |
253 | ||
254 | Type: has_many | |
255 | ||
256 | Related object: L<Gruntmaster::Data::Result::Job> | |
257 | ||
258 | =cut | |
259 | ||
260 | __PACKAGE__->has_many( | |
261 | "jobs", | |
262 | "Gruntmaster::Data::Result::Job", | |
263 | { "foreign.problem" => "self.id" }, | |
264 | { cascade_copy => 0, cascade_delete => 0 }, | |
265 | ); | |
266 | ||
6dda1f23 MG |
267 | =head2 limits |
268 | ||
269 | Type: has_many | |
270 | ||
271 | Related object: L<Gruntmaster::Data::Result::Limit> | |
272 | ||
273 | =cut | |
274 | ||
275 | __PACKAGE__->has_many( | |
276 | "limits", | |
277 | "Gruntmaster::Data::Result::Limit", | |
278 | { "foreign.problem" => "self.id" }, | |
279 | { cascade_copy => 0, cascade_delete => 0 }, | |
280 | ); | |
281 | ||
4ed3f8e7 MG |
282 | =head2 opens |
283 | ||
284 | Type: has_many | |
285 | ||
286 | Related object: L<Gruntmaster::Data::Result::Open> | |
287 | ||
288 | =cut | |
289 | ||
290 | __PACKAGE__->has_many( | |
291 | "opens", | |
292 | "Gruntmaster::Data::Result::Open", | |
293 | { "foreign.problem" => "self.id" }, | |
294 | { cascade_copy => 0, cascade_delete => 0 }, | |
295 | ); | |
296 | ||
297 | =head2 owner | |
298 | ||
299 | Type: belongs_to | |
300 | ||
301 | Related object: L<Gruntmaster::Data::Result::User> | |
302 | ||
303 | =cut | |
304 | ||
305 | __PACKAGE__->belongs_to( | |
306 | "owner", | |
307 | "Gruntmaster::Data::Result::User", | |
308 | { id => "owner" }, | |
9bb39921 | 309 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, |
4ed3f8e7 MG |
310 | ); |
311 | ||
adb42d4d MG |
312 | =head2 problem_statuses |
313 | ||
314 | Type: has_many | |
315 | ||
316 | Related object: L<Gruntmaster::Data::Result::ProblemStatus> | |
317 | ||
318 | =cut | |
319 | ||
320 | __PACKAGE__->has_many( | |
321 | "problem_statuses", | |
322 | "Gruntmaster::Data::Result::ProblemStatus", | |
323 | { "foreign.problem" => "self.id" }, | |
324 | { cascade_copy => 0, cascade_delete => 0 }, | |
325 | ); | |
326 | ||
4ed3f8e7 MG |
327 | =head2 contests |
328 | ||
329 | Type: many_to_many | |
330 | ||
331 | Composing rels: L</contest_problems> -> contest | |
332 | ||
333 | =cut | |
334 | ||
335 | __PACKAGE__->many_to_many("contests", "contest_problems", "contest"); | |
336 | ||
337 | ||
6dda1f23 MG |
338 | # Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-03-16 17:16:58 |
339 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N7cuqDEGSn5rf8V5GovRQQ | |
4ed3f8e7 | 340 | |
de7226ca MG |
341 | use Class::Method::Modifiers qw/after/; |
342 | ||
343 | after qw/insert update delete/ => sub { | |
344 | my ($self) = @_; | |
345 | Gruntmaster::Data::purge '/pb/'; | |
346 | Gruntmaster::Data::purge '/pb/' . $self->id; | |
78c794d6 | 347 | Gruntmaster::Data::purge '/sol/' . $self->id; |
de7226ca MG |
348 | }; |
349 | ||
4a8747ef MG |
350 | sub rerun { |
351 | $_->rerun for shift->jobs | |
352 | } | |
4ed3f8e7 | 353 | |
4ed3f8e7 | 354 | 1; |
4a8747ef MG |
355 | |
356 | __END__ | |
357 | ||
358 | =head1 METHODS | |
359 | ||
4a8747ef MG |
360 | =head2 rerun |
361 | ||
362 | Reruns all jobs for this problem. | |
363 | ||
364 | =head1 AUTHOR | |
365 | ||
366 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
367 | ||
368 | =head1 COPYRIGHT AND LICENSE | |
369 | ||
370 | Copyright (C) 2014 by Marius Gavrilescu | |
371 | ||
372 | This library is free software; you can redistribute it and/or modify | |
373 | it under the same terms as Perl itself, either Perl version 5.18.1 or, | |
374 | at your option, any later version of Perl 5 you may have available. | |
375 | ||
376 | ||
377 | =cut |