Add limit overrides
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 16 Mar 2015 15:17:51 +0000 (17:17 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 16 Mar 2015 15:28:48 +0000 (17:28 +0200)
db.sql
lib/Gruntmaster/Data.pm
lib/Gruntmaster/Data/Result/Limit.pm [new file with mode: 0644]
lib/Gruntmaster/Data/Result/Problem.pm

diff --git a/db.sql b/db.sql
index ba8a62198ee753f9c0e4a8cca78ea98528ff978b..a9ea727f3e64f5f861fd03150604dfb60e50e49f 100644 (file)
--- a/db.sql
+++ b/db.sql
@@ -99,6 +99,13 @@ CREATE TABLE opens (
        PRIMARY KEY (contest, problem, owner)
 );
 
+CREATE TABLE limits (
+       problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
+       format  TEXT NOT NULL,
+       timeout REAL NOT NULL,
+       PRIMARY KEY (problem, format)
+);
+
 CREATE TABLE table_comments (
        table_name   TEXT NOT NULL PRIMARY KEY,
        comment_text TEXT NOT NULL
@@ -119,6 +126,7 @@ INSERT INTO table_comments VALUES ('contest_problems', 'Many-to-many bridge betw
 INSERT INTO table_comments VALUES ('jobs',   'List of jobs');
 INSERT INTO table_comments VALUES ('problem_status', 'List of (problem, user, result)');
 INSERT INTO table_comments VALUES ('opens', 'List of (contest, problem, user, time when user opened problem)');
+INSERT INTO table_comments VALUES ('limits', 'Time limit overrides for certain problem/format pairs');
 
 INSERT INTO column_comments VALUES ('users', 'passphrase', 'RFC2307-encoded passphrase');
 INSERT INTO column_comments VALUES ('users', 'name', 'Full name of user');
index e3b56f43adf892284f04c0f7842384907f06ac2e..fa81e76b926301d25eaf33e7963d2fa6b02b8f45 100644 (file)
@@ -37,7 +37,7 @@ sub dynsub{
 }
 
 BEGIN {
-       for my $rs (qw/contest contest_problem job open problem user problem_status contest_status/) {
+       for my $rs (qw/contest contest_problem job open limit problem user problem_status contest_status/) {
                my $rsname = ucfirst $rs;
                $rsname =~ s/_([a-z])/\u$1/gs;
                dynsub PL_N($rs) => sub { $_[0]->resultset($rsname)              };
diff --git a/lib/Gruntmaster/Data/Result/Limit.pm b/lib/Gruntmaster/Data/Result/Limit.pm
new file mode 100644 (file)
index 0000000..83b85e3
--- /dev/null
@@ -0,0 +1,90 @@
+use utf8;
+package Gruntmaster::Data::Result::Limit;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Gruntmaster::Data::Result::Limit - Time limit overrides for certain problem/format pairs
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<limits>
+
+=cut
+
+__PACKAGE__->table("limits");
+
+=head1 ACCESSORS
+
+=head2 problem
+
+  data_type: 'text'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 format
+
+  data_type: 'text'
+  is_nullable: 0
+
+=head2 timeout
+
+  data_type: 'real'
+  is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+  "problem",
+  { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
+  "format",
+  { data_type => "text", is_nullable => 0 },
+  "timeout",
+  { data_type => "real", is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</problem>
+
+=item * L</format>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("problem", "format");
+
+=head1 RELATIONS
+
+=head2 problem
+
+Type: belongs_to
+
+Related object: L<Gruntmaster::Data::Result::Problem>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "problem",
+  "Gruntmaster::Data::Result::Problem",
+  { id => "problem" },
+  { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-03-16 17:16:58
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ewngP+tVnk4GZ5K+ygUpLg
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
index cec4cc89bc4cf0ac6821a16c1b0a0e3c7514a11e..c067c765886a8edd5858cbddd0207f0721e68c7d 100644 (file)
@@ -264,6 +264,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 limits
+
+Type: has_many
+
+Related object: L<Gruntmaster::Data::Result::Limit>
+
+=cut
+
+__PACKAGE__->has_many(
+  "limits",
+  "Gruntmaster::Data::Result::Limit",
+  { "foreign.problem" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 opens
 
 Type: has_many
@@ -320,8 +335,8 @@ Composing rels: L</contest_problems> -> contest
 __PACKAGE__->many_to_many("contests", "contest_problems", "contest");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-02-14 09:42:26
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sc9vhXkFlp0UaLK7w0OUXA
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-03-16 17:16:58
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N7cuqDEGSn5rf8V5GovRQQ
 
 use Class::Method::Modifiers qw/after/;
 
This page took 0.015593 seconds and 4 git commands to generate.