From cbb36c78b915857f6b36ed94b99cdf71bfd7fca2 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 16 May 2014 19:03:43 +0300 Subject: [PATCH] Update POD --- lib/Gruntmaster/Data.pm | 69 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index e8dfbd9..2939edb 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -48,11 +48,76 @@ Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tool =head1 SYNOPSIS my $db = Gruntmaster::Data->connect('dbi:Pg:'); - # Typical DBIC stuff here + + my $problem = $db->problem('my_problem'); + $problem->update({timeout => 2.5}); # Set time limit to 2.5 seconds + $problem->rerun; # And rerun all jobs for this problem + + # ... + + my $contest = $db->contests->create({ # Create a new contest + id => 'my_contest', + name => 'My Awesome Contest', + start => time + 100, + end => time + 1900, + }); + $db->contest_problems->create({ # Add a problem to the contest + contest => 'my_contest', + problem => 'my_problem', + }); + + say 'The contest has not started yet' if $contest->is_pending; + + # ... + + my @jobs = $db->jobs->search({contest => 'my_contest', owner => 'MGV'})->all; + $_->rerun for @jobs; # Rerun all jobs sent by MGV in my_contest =head1 DESCRIPTION -No documentation (yet) +Gruntmaster::Data is the interface to the Gruntmaster 6000 database. Read the L documentation for usage information. + +In addition to the typical DBIx::Class::Schema methods, this module contains several convenience methods: + +=over + +=item contests + +Equivalent to C<< $schema->resultset('Contest') >> + +=item contest_problems + +Equivalent to C<< $schema->resultset('ContestProblem') >> + +=item jobs + +Equivalent to C<< $schema->resultset('Job') >> + +=item problems + +Equivalent to C<< $schema->resultset('Problem') >> + +=item users + +Equivalent to C<< $schema->resultset('User') >> + +=item contest($id) + +Equivalent to C<< $schema->resultset('Contest')->find($id) >> + +=item job($id) + +Equivalent to C<< $schema->resultset('Job')->find($id) >> + +=item problem($id) + +Equivalent to C<< $schema->resultset('Problem')->find($id) >> + +=item user($id) + +Equivalent to C<< $schema->resultset('User')->find($id) >> + +=back =head1 AUTHOR -- 2.30.2