source: trunk/scripts/migrate_task_parameters @ 1184

Revision 996, 1.6 KB checked in by bogdan2412, 3 years ago (diff)

Detailed feedback

  • Moved (and renamed) task parameters "tests", "testgroups", "okfiles" and "evaluator" to ia_task (they will be common to every task type anyway). Only memlimit and timelimit remain in ia_parameter_value for tasks.
  • Added 'public_tests' column to ia_task in which you can specify tests for detailed feedback in the same format as a group in 'test_groups'
  • Added "job-view-partial-feedback" permission. Users should only be able to see their own feedback, not that of others.
  • Added UI for job_detail to show results on public tests
  • Made monitor show when detailed feedback is available for a job

Extra

  • Moved score and size hiding in monitor from view to controller
  • Added "job-view-score" permission check to job_view_source controller

Reviewed: http://reviewboard.infoarena.ro/r/46/

  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3
4require_once(dirname($argv[0]) . "/utilities.php");
5
6db_connect();
7
8db_query("
9ALTER TABLE `ia_task`
10    ADD COLUMN `test_count` INTEGER NOT NULL DEFAULT 10,
11    ADD COLUMN `test_groups` VARCHAR(256),
12    ADD COLUMN `public_tests` VARCHAR(256),
13    ADD COLUMN `evaluator` VARCHAR(64),
14    ADD COLUMN `use_ok_files` TINYINT(1) NOT NULL DEFAULT 1");
15
16$query = "SELECT * FROM `ia_parameter_value`
17          WHERE `object_type` = 'task' AND
18                `parameter_id` != 'memlimit' AND
19                `parameter_id` != 'timelimit'";
20$rows = db_fetch_all($query);
21
22$tasks = array();
23
24foreach ($rows as $row) {
25    $task_id = $row["object_id"];
26    if (!array_key_exists($task_id, $tasks)) {
27        $tasks[$task_id] = array();
28    }
29
30    $tasks[$task_id][$row["parameter_id"]] = $row["value"];
31}
32
33foreach ($tasks as $task_id => $task) {
34    $params = array();
35
36    if (!isset($task["tests"])) {
37        log_error("Task $task_id doesn't have a test number");
38    } else {
39        $params["test_count"] = $task["tests"];
40    }
41    if (!isset($task["okfiles"])) {
42        log_error("Task $task_id doesn't have a okfiles bool");
43    } else {
44        $params["use_ok_files"] = $task["okfiles"];
45    }
46
47    $params["test_groups"] = getattr($task, "testgroups", "");
48    $params["evaluator"] = getattr($task, "evaluator", "");
49
50    log_print("Migrating parameters for task $task_id");
51    db_update('ia_task', $params, '`id` = ' . db_quote($task_id));
52}
53
54db_query("DELETE FROM `ia_parameter_value`
55          WHERE `object_type` = 'task' AND
56                `parameter_id` != 'timelimit' AND
57                `parameter_id` != 'memlimit'");
58
59?>
60
Note: See TracBrowser for help on using the repository browser.