]> iEval git - gruntmaster-data.git/commitdiff
Make redis-to-postgres also copy problems which are only in a contest
authorMarius Gavrilescu <marius@ieval.ro>
Tue, 25 Mar 2014 12:42:49 +0000 (14:42 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 25 Mar 2014 12:53:08 +0000 (14:53 +0200)
db.sql
redis-to-postgres

diff --git a/db.sql b/db.sql
index eafd89ed66f0f79870200ef168a763e3a3e744c8..3a43eb5c99b0747c69acfea559de6cf99e50aece 100644 (file)
--- a/db.sql
+++ b/db.sql
@@ -25,7 +25,7 @@ CREATE TABLE contests (
 
 CREATE TABLE problems (
        id        TEXT      PRIMARY KEY,
-       author    TEXT      NOT NULL,
+       author    TEXT,
        generator GENERATOR NOT NULL,
        judge     JUDGE     NOT NULL,
        level     PLEVEL    NOT NULL,
@@ -61,7 +61,7 @@ CREATE TABLE jobs (
        problem     TEXT    NOT NULL REFERENCES problems,
        result      INT,
        result_text TEXT,
-       results     JSON,
+       results     TEXT,
        source      TEXT    NOT NULL,
        owner       TEXT    NOT NULL REFERENCES users
 );
index 330d5a6e0cee6c140d62fc8b30443089eadc5de9..979f324ea57a6f437e33e94e418e86548056e8e0 100755 (executable)
@@ -52,6 +52,26 @@ for (contests) {
        });
        local $Gruntmaster::OldData::contest = $_;
        for (problems) {
+               eval {
+                       my $meta = problem_meta;
+                       $db->problems->create({
+                               id => $_,
+                               author => problem_author,
+                               generator => problem_generator() // $meta->{generator},
+                               judge => problem_judge() // $meta->{judge},
+                               level => problem_level,
+                               name => problem_name,
+                               olimit => problem_olimit() // $meta->{olimit},
+                               owner => problem_owner,
+                               private => (problem_private() ? 1 : 0),
+                               runner => problem_runner() // $meta->{runner},
+                               statement => problem_statement,
+                               testcnt => problem_testcnt() // $meta->{testcnt},
+                               timeout => problem_timeout() // $meta->{timeout},
+                               (problem_runner() // $meta->{runner}) eq 'File' ? (tests => encode_json $meta->{tests}) : (),
+                               exists $meta->{files} ? (versource => $meta->{files}{ver}{content}, verformat => $meta->{files}{ver}{format}) : ()
+                       })
+               };
                $db->contest_problems->create({
                        contest => $Gruntmaster::OldData::contest,
                        problem => $_,
This page took 0.035585 seconds and 4 git commands to generate.