NAME

Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools

SYNOPSIS

my $db = Gruntmaster::Data->connect('dbi:Pg:');

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

DESCRIPTION

Gruntmaster::Data is the interface to the Gruntmaster 6000 database. Read the DBIx::Class documentation for usage information.

In addition to the typical DBIx::Class::Schema methods, this module contains several convenience methods:

contests

Equivalent to $schema->resultset('Contest')

contest_problems

Equivalent to $schema->resultset('ContestProblem')

jobs

Equivalent to $schema->resultset('Job')

problems

Equivalent to $schema->resultset('Problem')

users

Equivalent to $schema->resultset('User')

contest($id)

Equivalent to $schema->resultset('Contest')->find($id)

job($id)

Equivalent to $schema->resultset('Job')->find($id)

problem($id)

Equivalent to $schema->resultset('Problem')->find($id)

user($id)

Equivalent to $schema->resultset('User')->find($id)

AUTHOR

Marius Gavrilescu <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.1 or, at your option, any later version of Perl 5 you may have available.