]>
Commit | Line | Data |
---|---|---|
bbf8209c | 1 | package Gruntmaster::Data; |
6c0423f4 | 2 | use 5.014; |
bbf8209c | 3 | use warnings; |
014ee8a6 | 4 | |
edfc5928 | 5 | use parent qw/Exporter/; |
add75bf5 | 6 | our $VERSION = '5999.000_015'; |
dcf7f640 | 7 | our @EXPORT = qw/dbinit purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_has_problem job_list job_entry create_job standings update_status rerun_job take_job finish_job open_problem/; |
6dfc2864 | 8 | our @EXPORT_OK = @EXPORT; |
4ed3f8e7 | 9 | |
91203bd5 | 10 | use JSON::MaybeXS qw/decode_json/; |
edfc5928 | 11 | use HTTP::Tiny; |
3473324b | 12 | use PerlX::Maybe qw/maybe/; |
52172a1a MG |
13 | |
14 | use DBI; | |
15 | use DBIx::Simple; | |
16 | use List::Util qw/sum/; | |
17 | use SQL::Abstract; | |
014ee8a6 | 18 | |
e890b3ae | 19 | use constant PROBLEM_PUBLIC_COLUMNS => [qw/id author writer level name owner private timeout olimit value/]; |
e1250e20 | 20 | use constant JOBS_PER_PAGE => 50; |
de625c9b | 21 | |
52172a1a MG |
22 | my %statements = ( |
23 | user_list_sth => 'SELECT * FROM user_list LIMIT 200', | |
24 | user_entry_sth => 'SELECT * FROM user_data WHERE id = ?', | |
25 | ||
26 | problem_status_sth => 'SELECT problem,solved FROM problem_status WHERE owner = ?', | |
27 | contest_status_sth => 'SELECT contest,score,rank FROM contest_status WHERE owner = ?', | |
28 | ||
29 | contest_list_sth => 'SELECT * FROM contest_entry', | |
30 | contest_entry_sth => 'SELECT * FROM contest_entry WHERE id = ?', | |
52172a1a MG |
31 | contest_has_problem_sth => 'SELECT EXISTS(SELECT 1 FROM contest_problems WHERE contest = ? AND problem = ?)', |
32 | opens_sth => 'SELECT problem,owner,time FROM opens WHERE contest = ?', | |
33 | ||
34 | problem_entry_sth => 'SELECT ' . (join ',', @{PROBLEM_PUBLIC_COLUMNS()}, 'statement', 'solution') . ' FROM problems WHERE id = ?', | |
35 | limits_sth => 'SELECT format,timeout FROM limits WHERE problem = ?', | |
52172a1a MG |
36 | |
37 | job_entry_sth => 'SELECT * FROM job_entry WHERE id = ?', | |
341fb893 MG |
38 | |
39 | rerun_job_sth => 'UPDATE jobs SET daemon=NULL,result=-2,result_text=NULL,results=NULL,errors=NULL WHERE id = ?', | |
9dc335bd | 40 | take_job_sth => 'UPDATE jobs SET daemon=? WHERE id = (SELECT id FROM jobs WHERE daemon IS NULL LIMIT 1 FOR UPDATE) RETURNING id', |
52172a1a MG |
41 | ); |
42 | ||
50b165c3 | 43 | our $db; |
341fb893 | 44 | sub db () { $db } |
23aa7eca | 45 | |
6fb81f9a | 46 | sub dbinit { |
62a58bf3 MG |
47 | $db = DBIx::Simple->new(@_); |
48 | $db->keep_statements = 100; | |
52172a1a MG |
49 | }; |
50 | ||
51 | sub purge; | |
52 | ||
d2c2ee95 | 53 | sub _query { |
62a58bf3 | 54 | my ($stat, @extra) = @_; |
4623c9f2 | 55 | $db->query($statements{$stat}, @extra) |
52172a1a MG |
56 | } |
57 | ||
58 | my (%name_cache, %name_cache_time); | |
59 | use constant NAME_CACHE_MAX_AGE => 5; | |
60 | ||
d2c2ee95 | 61 | sub _object_name { |
62a58bf3 | 62 | my ($table, $id) = @_; |
52172a1a MG |
63 | $name_cache_time{$table} //= 0; |
64 | if (time - $name_cache_time{$table} > NAME_CACHE_MAX_AGE) { | |
65 | $name_cache_time{$table} = time; | |
66 | $name_cache{$table} = {}; | |
62a58bf3 | 67 | $name_cache{$table} = $db->select($table, 'id,name')->map; |
52172a1a MG |
68 | } |
69 | ||
70 | $name_cache{$table}{$id} | |
71 | } | |
72 | ||
73 | ||
d2c2ee95 | 74 | sub _add_names ($) { ## no critic (ProhibitSubroutinePrototypes) |
62a58bf3 | 75 | my ($el) = @_; |
ee00be0c | 76 | return unless defined $el; |
52172a1a | 77 | if (ref $el eq 'ARRAY') { |
d2c2ee95 | 78 | &_add_names ($_) for @$el ## no critic (ProhibitAmpersandSigils) |
52172a1a MG |
79 | } else { |
80 | for my $object (qw/contest owner problem/) { | |
81 | my $table = $object eq 'owner' ? 'users' : "${object}s"; | |
d2c2ee95 | 82 | $el->{"${object}_name"} = _object_name $table, $el->{$object} if defined $el->{$object} |
52172a1a MG |
83 | } |
84 | } | |
85 | ||
86 | $el | |
87 | } | |
88 | ||
d2c2ee95 | 89 | sub user_list { scalar _query('user_list_sth')->hashes } |
52172a1a MG |
90 | |
91 | sub user_entry { | |
62a58bf3 | 92 | my ($id) = @_; |
d2c2ee95 MG |
93 | my $ret = _query('user_entry_sth', $id)->hash; |
94 | $ret->{problems} = _add_names _query('problem_status_sth', $id)->hashes; | |
95 | $ret->{contests} = _add_names _query('contest_status_sth', $id)->hashes; | |
52172a1a | 96 | |
52172a1a MG |
97 | $ret; |
98 | } | |
99 | ||
52172a1a | 100 | sub problem_list { |
62a58bf3 | 101 | my (%args) = @_; |
52172a1a MG |
102 | my @columns = @{PROBLEM_PUBLIC_COLUMNS()}; |
103 | push @columns, 'solution' if $args{solution}; | |
104 | my %where; | |
105 | $where{private} = 0 unless $args{contest} || $args{private}; | |
106 | $where{'cp.contest'} = $args{contest} if $args{contest}; | |
107 | $where{owner} = $args{owner} if $args{owner}; | |
108 | ||
109 | my $table = $args{contest} ? 'problems JOIN contest_problems cp ON cp.problem = id' : 'problems'; | |
d2c2ee95 | 110 | _add_names $db->select(\$table, \@columns, \%where, 'name')->hashes |
52172a1a MG |
111 | } |
112 | ||
52172a1a | 113 | sub problem_entry { |
a1a4325a | 114 | my ($id, $contest) = @_; |
4623c9f2 | 115 | $contest = contest_entry ($contest) if $contest; |
d2c2ee95 MG |
116 | my $ret = _add_names _query(problem_entry_sth => $id)->hash; |
117 | my $limits = _query(limits_sth => $id)->hashes; | |
52172a1a MG |
118 | $ret->{limits} = $limits if @$limits; |
119 | ||
120 | if ($contest) { | |
121 | $ret->{contest_start} = $contest->{start}; | |
122 | $ret->{contest_stop} = $contest->{stop}; | |
d33e87f2 | 123 | delete $ret->{solution} |
52172a1a MG |
124 | } |
125 | ||
126 | $ret | |
127 | } | |
128 | ||
d2c2ee95 | 129 | sub contest_list { _add_names _query('contest_list_sth')->hashes } |
52172a1a | 130 | |
d2c2ee95 | 131 | sub contest_entry { _add_names _query(contest_entry_sth => $_[0])->hash } |
52172a1a | 132 | |
d2c2ee95 | 133 | sub contest_has_problem { _query('contest_has_problem_sth', @_[0, 1])->flat } |
52172a1a | 134 | |
52172a1a | 135 | sub job_list { |
62a58bf3 | 136 | my (%args) = @_; |
b69781c1 | 137 | $args{page} = int ($args{page} // 1); |
52172a1a MG |
138 | my %where = ( |
139 | maybe contest => $args{contest}, | |
140 | maybe owner => $args{owner}, | |
141 | maybe problem => $args{problem}, | |
142 | maybe result => $args{result}, | |
143 | ); | |
144 | $where{private} = 0 unless $args{private}; | |
145 | ||
62a58bf3 | 146 | my $rows = $db->select('job_entry', 'COUNT(*)', \%where)->list; |
52172a1a | 147 | my $pages = int (($rows + JOBS_PER_PAGE - 1) / JOBS_PER_PAGE); |
62a58bf3 | 148 | my ($stmt, @bind) = $db->abstract->select('job_entry', '*', \%where, {-desc => 'id'}); |
d2c2ee95 | 149 | my $jobs = _add_names $db->query("$stmt LIMIT " . JOBS_PER_PAGE . ' OFFSET ' . ($args{page} - 1) * JOBS_PER_PAGE, @bind)->hashes; |
b69781c1 | 150 | my $pageinfo = { |
52172a1a MG |
151 | current_page => $args{page}, |
152 | last_page => $pages, | |
b69781c1 MG |
153 | ($args{page} - 1) ? (previous_page => $args{page} - 1) : (), |
154 | ($args{page} < $pages) ? (next_page => $args{page} + 1) : (), | |
155 | }; | |
156 | wantarray ? ($jobs, $pageinfo) : $jobs; | |
52172a1a MG |
157 | } |
158 | ||
159 | sub job_entry { | |
d2c2ee95 | 160 | my $ret = _add_names _query(job_entry_sth => $_[0])->hash; |
4623c9f2 | 161 | $ret->{results} = decode_json $ret->{results} if $ret->{results}; |
62a58bf3 | 162 | $ret |
52172a1a MG |
163 | } |
164 | ||
52172a1a | 165 | sub create_job { |
62a58bf3 | 166 | my (%args) = @_; |
5e77eeae | 167 | $db->update('users', {lastjob => time}, {id => $args{owner}}); |
52172a1a | 168 | purge '/log/'; |
62a58bf3 | 169 | scalar $db->insert('jobs', \%args, {returning => 'id'})->list |
52172a1a MG |
170 | } |
171 | ||
01fcdebe | 172 | sub _calc_score { |
52172a1a MG |
173 | my ($mxscore, $time, $tries, $totaltime) = @_; |
174 | my $score = $mxscore; | |
4623c9f2 | 175 | $time = 300 if $time > $totaltime; # uncoverable branch true does not happen anymore (only possible if opens are broken) |
52172a1a MG |
176 | $score = ($totaltime - $time) / $totaltime * $score; |
177 | $score -= $tries / 10 * $mxscore; | |
178 | $score = $mxscore * 3 / 10 if $score < $mxscore * 3 / 10; | |
179 | int $score + 0.5 | |
180 | } | |
181 | ||
182 | sub standings { | |
62a58bf3 | 183 | my ($ct) = @_; |
01fcdebe MG |
184 | my @problems = sort { $a->{value} <=> $b->{value} } @{problem_list contest => $ct}; |
185 | my %values = map { $_->{id} => $_->{value} } @problems; | |
62a58bf3 | 186 | $ct = contest_entry $ct; |
52172a1a | 187 | |
52172a1a | 188 | my (%scores, %tries, %opens); |
d2c2ee95 | 189 | my $opens = _query(opens_sth => $ct->{id}); |
52172a1a MG |
190 | while ($opens->into(my ($problem, $owner, $time))) { |
191 | $opens{$problem, $owner} = $time; | |
192 | } | |
193 | ||
62a58bf3 | 194 | my $jobs = $db->select('job_entry', '*', {contest => $ct->{id}}, 'id'); |
52172a1a MG |
195 | |
196 | while (my $job = $jobs->hash) { | |
197 | my $open = $opens{$job->{problem}, $job->{owner}} // $ct->{start}; | |
198 | my $time = $job->{date} - $open; | |
4623c9f2 | 199 | next if $time < 0; # uncoverable branch true job sent before contest is deprecated |
52172a1a MG |
200 | my $value = $values{$job->{problem}}; |
201 | my $factor = $job->{result} ? 0 : 1; | |
202 | $factor = $1 / 100 if $job->{result_text} =~ /^(\d+ )/s; | |
01fcdebe | 203 | $scores{$job->{owner}}{$job->{problem}} = int ($factor * _calc_score ($value, $time, $tries{$job->{owner}}{$job->{problem}}++, $ct->{stop} - $ct->{start})); |
52172a1a MG |
204 | } |
205 | ||
206 | my @st = sort { $b->{score} <=> $a->{score} or $a->{user} cmp $b->{user} } map { ## no critic (ProhibitReverseSortBlock) | |
207 | my $user = $_; | |
208 | +{ | |
209 | user => $user, | |
d2c2ee95 | 210 | user_name => _object_name(users => $user), |
52172a1a | 211 | score => sum (values %{$scores{$user}}), |
01fcdebe | 212 | scores => [map { $scores{$user}{$_->{id}} // '-'} @problems], |
52172a1a MG |
213 | } |
214 | } keys %scores; | |
215 | ||
216 | $st[0]->{rank} = 1 if @st; | |
217 | $st[$_]->{rank} = $st[$_ - 1]->{rank} + ($st[$_]->{score} < $st[$_ - 1]->{score}) for 1 .. $#st; | |
01fcdebe MG |
218 | |
219 | \@st | |
52172a1a MG |
220 | } |
221 | ||
52172a1a | 222 | sub update_status { |
1761e170 | 223 | my $jobs = $db->select('jobs', 'id,owner,problem,result', {-not_bool => 'private'}, 'id'); |
52172a1a MG |
224 | |
225 | my %hash; | |
226 | while ($jobs->into(my ($id, $owner, $problem, $result))) { | |
227 | $hash{$problem, $owner} = [$id, $result ? 0 : 1]; | |
228 | } | |
229 | ||
230 | my @problem_statuses = map { [split ($;), @{$hash{$_}} ] } keys %hash; | |
231 | ||
232 | my @contest_statuses = map { | |
233 | my $ct = $_; | |
01fcdebe | 234 | map { [$ct, $_->{user}, $_->{score}, $_->{rank}] } @{standings $ct} |
62a58bf3 MG |
235 | } $db->select('contests', 'id')->flat; |
236 | ||
237 | $db->begin; | |
238 | $db->delete('problem_status'); | |
239 | $db->query('INSERT INTO problem_status (problem,owner,job,solved) VALUES (??)', @$_) for @problem_statuses; | |
240 | $db->delete('contest_status'); | |
241 | $db->query('INSERT INTO contest_status (contest,owner,score,rank) VALUES (??)', @$_) for @contest_statuses; | |
242 | $db->commit | |
52172a1a MG |
243 | } |
244 | ||
341fb893 MG |
245 | sub rerun_job { |
246 | my ($id) = @_; | |
d2c2ee95 | 247 | _query rerun_job_sth => $id; |
341fb893 MG |
248 | purge '/log/'; |
249 | purge "/log/$id"; | |
250 | } | |
251 | ||
9dc335bd MG |
252 | sub take_job { |
253 | my ($daemon) = @_; | |
d2c2ee95 | 254 | my $id = _query(take_job_sth => $daemon)->list; |
3ceb2ad0 MG |
255 | return unless $id; |
256 | purge '/log/'; | |
257 | purge "/log/$id"; | |
258 | db->select(jobs => '*', {id => $id})->hash | |
9dc335bd MG |
259 | } |
260 | ||
261 | sub finish_job { | |
262 | my ($job, $private, %args) = @_; | |
263 | db->update(jobs => \%args, {id => $job->{id}}); | |
3ceb2ad0 MG |
264 | purge '/log/'; |
265 | purge '/log/' . $job->{id}; | |
9dc335bd MG |
266 | return if $private; |
267 | my $status = { | |
268 | problem => $job->{problem}, | |
269 | owner => $job->{owner}, | |
270 | job => $job->{id}, | |
271 | solved => ($args{result} ? 0 : 1), | |
272 | }; | |
273 | eval { | |
274 | db->insert(problem_status => $status) | |
275 | } or db->update(problem_status => $status, {owner => $job->{owner}, problem => $job->{problem}}); | |
3ceb2ad0 | 276 | purge '/us/' . $job->{owner}; |
9dc335bd MG |
277 | } |
278 | ||
f7e9da17 MG |
279 | sub open_problem { |
280 | my ($contest, $problem, $owner, $time) = @_; | |
281 | my $ct = contest_entry($contest); | |
dcf7f640 MG |
282 | return unless $ct->{id} && $time >= $ct->{start} && $time < $ct->{stop}; ## no critic (ProhibitNegativeExpressionsInUnlessAndUntilConditions) |
283 | eval { db->insert(opens => { ## no critic (RequireCheckingReturnValueOfEval) | |
f7e9da17 MG |
284 | contest => $contest, |
285 | problem => $problem, | |
286 | owner => $owner, | |
287 | time => $time}) }; | |
288 | } | |
289 | ||
edfc5928 MG |
290 | my @PURGE_HOSTS = exists $ENV{PURGE_HOSTS} ? split ' ', $ENV{PURGE_HOSTS} : (); |
291 | my $ht = HTTP::Tiny->new; | |
292 | ||
de7226ca MG |
293 | sub purge { |
294 | $ht->request(PURGE => "http://$_$_[0]") for @PURGE_HOSTS; | |
295 | } | |
edfc5928 | 296 | |
f7386aab | 297 | 1; |
4a8747ef MG |
298 | |
299 | __END__ | |
300 | ||
301 | =encoding utf-8 | |
302 | ||
303 | =head1 NAME | |
304 | ||
305 | Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools | |
306 | ||
307 | =head1 SYNOPSIS | |
308 | ||
4a8747ef MG |
309 | |
310 | =head1 DESCRIPTION | |
311 | ||
23183b19 | 312 | Gruntmaster::Data is the interface to the Gruntmaster 6000 database. |
cbb36c78 | 313 | |
23183b19 | 314 | All functions are exported by default. |
cbb36c78 MG |
315 | |
316 | =over | |
317 | ||
23183b19 | 318 | =item B<dbinit>(I<@args>) |
cbb36c78 | 319 | |
23183b19 MG |
320 | This function connects to the database. I<@args> are the arguments |
321 | passed to the L<DBIx::Simple> constructor. | |
cbb36c78 | 322 | |
23183b19 | 323 | =item B<purge>(I<$url_path>) |
cbb36c78 | 324 | |
23183b19 MG |
325 | Purges a relative URL from the Varnish Cache by sending PURGE |
326 | $url_path requests to all hosts in the PURGE_HOSTS environment | |
327 | variable. | |
cbb36c78 | 328 | |
23183b19 | 329 | =item B<db> |
cbb36c78 | 330 | |
23183b19 MG |
331 | Returns a L<DBIx::Simple> object for interacting with the database |
332 | directly. Use this when no other function in this module is suitable. | |
cbb36c78 | 333 | |
23183b19 | 334 | =item B<user_list> |
cbb36c78 | 335 | |
23183b19 | 336 | Returns an arrayref of the top 200 users. |
cbb36c78 | 337 | |
23183b19 | 338 | =item B<user_entry>(I<$id>) |
cbb36c78 | 339 | |
23183b19 | 340 | Returns a hashref describing the user I<$id>. |
cbb36c78 | 341 | |
23183b19 | 342 | =item B<problem_list>([I<%args>]) |
cbb36c78 | 343 | |
23183b19 | 344 | Returns an arrayref of problems. |
cbb36c78 | 345 | |
23183b19 | 346 | Takes the following named arguments: |
cbb36c78 | 347 | |
23183b19 | 348 | =over |
cbb36c78 | 349 | |
23183b19 | 350 | =item owner |
cbb36c78 | 351 | |
23183b19 | 352 | Only show problems owned by this user |
cbb36c78 | 353 | |
23183b19 | 354 | =item contest |
cbb36c78 | 355 | |
23183b19 | 356 | Only show problems in this contest |
de625c9b | 357 | |
23183b19 | 358 | =item private |
de625c9b | 359 | |
23183b19 | 360 | If true, include private problems. Always true if contest is present. |
de625c9b | 361 | |
23183b19 | 362 | =item solution |
de625c9b | 363 | |
23183b19 | 364 | If true, include problem solutions |
de625c9b | 365 | |
23183b19 | 366 | =back |
de625c9b | 367 | |
23183b19 | 368 | =item B<problem_entry>(i<$id>, [I<$contest>]) |
de625c9b | 369 | |
23183b19 MG |
370 | Returns a hashref describing the problem I<$id>. If $contest is |
371 | present, contest start and stop times are included, and the solution | |
372 | is deleted. | |
de625c9b | 373 | |
23183b19 | 374 | =item B<contest_list> |
de625c9b | 375 | |
23183b19 | 376 | Returns an arrayref of contests. |
de625c9b | 377 | |
23183b19 | 378 | =item B<contest_entry>(I<$id>) |
de625c9b | 379 | |
23183b19 | 380 | Returns a hashref describing the contest I<$id>. |
de625c9b | 381 | |
23183b19 | 382 | =item B<contest_has_problem>(I<$contest>, I<$problem>) |
de625c9b | 383 | |
23183b19 MG |
384 | Returns true if the contest I<$contest> includes the problem |
385 | I<$problem>, false otherwise. | |
de625c9b | 386 | |
23183b19 | 387 | =item B<job_list>([I<%args>]) |
de625c9b | 388 | |
23183b19 MG |
389 | In scalar context, returns an arrayref of jobs. In list context, |
390 | returns an arrayref of jobs and a hashref of information about pages. | |
de625c9b | 391 | |
23183b19 | 392 | Takes the following named arguments: |
de625c9b MG |
393 | |
394 | =over | |
395 | ||
23183b19 | 396 | =item page |
de625c9b | 397 | |
23183b19 | 398 | Show this page of the job log. Defaults to 1. |
de625c9b | 399 | |
23183b19 | 400 | =item owner |
de625c9b | 401 | |
23183b19 | 402 | Only show jobs submitted by this user. |
de625c9b | 403 | |
23183b19 | 404 | =item contest |
de625c9b | 405 | |
23183b19 | 406 | Only show jobs submitted in this contest. |
de625c9b | 407 | |
23183b19 | 408 | =item problem |
de625c9b | 409 | |
23183b19 | 410 | Only show jobs submitted for this problem. |
de625c9b | 411 | |
23183b19 | 412 | =item result |
de625c9b | 413 | |
23183b19 MG |
414 | Only show jobs with this result (see the constants in |
415 | L<Gruntmaster::Daemon::Constants>). | |
de625c9b | 416 | |
23183b19 | 417 | =item private |
de625c9b | 418 | |
23183b19 | 419 | If true, include private jobs. Defaults to false. |
de625c9b | 420 | |
23183b19 | 421 | =back |
de625c9b | 422 | |
23183b19 | 423 | =item B<job_entry>(I<$id>) |
de625c9b | 424 | |
23183b19 | 425 | Returns a hashref describing the job I<$id>. |
de625c9b | 426 | |
23183b19 | 427 | =item B<create_job>(I<%args>) |
de625c9b | 428 | |
23183b19 MG |
429 | Insert a new job into the database. This function also updates the |
430 | lastjob field for the job's owner. | |
de625c9b | 431 | |
23183b19 | 432 | =item B<standings>(I<$ct>) |
de625c9b | 433 | |
23183b19 | 434 | Returns an arrayref of the standings of contest I<$ct>. |
de625c9b | 435 | |
23183b19 | 436 | =item B<update_status> |
de625c9b | 437 | |
23183b19 | 438 | Rebuilds the problem_status and contest_status tables. |
de625c9b | 439 | |
23183b19 | 440 | =item B<rerun_job>(I<$id>) |
de625c9b | 441 | |
23183b19 MG |
442 | Marks the job $id as pending and clears its results, so that it will |
443 | be run again by the daemon. | |
de625c9b | 444 | |
23183b19 | 445 | =item B<take_job>(I<$daemon>) |
de625c9b | 446 | |
23183b19 MG |
447 | Marks a random job as being run by I<$daemon>. Returns a hashref |
448 | describing the job, or undef if no job was available. | |
de625c9b | 449 | |
23183b19 | 450 | =item B<finish_job>(I<$job>, I<$private>, I<%results>) |
de625c9b | 451 | |
23183b19 MG |
452 | Updates the job $job with the results in %results. If $private is |
453 | false, also updates the problem_status table. | |
de625c9b | 454 | |
f7e9da17 MG |
455 | =item B<open_problem>(I<$contest>, I<$problem>, I<$owner>, I<$time>) |
456 | ||
457 | Notes that I<$owner> has opened the problem I<$problem> of contest | |
458 | I<$contest> at time I<$time>. If the C<opens> table already contains | |
459 | this (I<$contest>, I<$problem>, I<$owner>) triplet, this function does | |
460 | nothing. | |
461 | ||
cbb36c78 | 462 | =back |
4a8747ef MG |
463 | |
464 | =head1 AUTHOR | |
465 | ||
466 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
467 | ||
468 | =head1 COPYRIGHT AND LICENSE | |
469 | ||
e1b9f3dd | 470 | Copyright (C) 2014-2015 by Marius Gavrilescu |
4a8747ef | 471 | |
9d2e740e | 472 | This library is free software; you can redistribute it and/or modify |
e1b9f3dd | 473 | it under the same terms as Perl itself, either Perl version 5.20.1 or, |
9d2e740e | 474 | at your option, any later version of Perl 5 you may have available. |
4a8747ef MG |
475 | |
476 | ||
477 | =cut |