source: trunk/common/parameter.php @ 996

Revision 996, 1.4 KB checked in by btataroiu@…, 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:eol-style set to native
Line 
1<?php
2
3require_once(IA_ROOT_DIR . "common/db/db.php");
4
5// FIXME: obliterate?
6//
7// Parses parameter value as stored in database and returns native PHP value
8// $parameter_id    parameter type (id)
9// $value           raw value string stored in database
10function parameter_decode($parameter_id, $value) {
11    $booleans = array('rating_update');
12    $ints = array('memlimit', 'rating_timestamp');
13    $floats = array('timelimit');
14    $strings = array();
15
16    if (in_array($parameter_id, $booleans)) {
17        if ("1" == $value) {
18            return true;
19        }
20        elseif ("0" == $value || "" == $value) {
21            return false;
22        }
23        log_error("Invalid boolean value: ".$value);
24    }
25    elseif (in_array($parameter_id, $ints)) {
26        if (is_whole_number($value)) {
27            return (int)$value;
28        }
29        log_error("Invalid integer value: ".$value);
30    }
31    elseif (in_array($parameter_id, $floats)) {
32        if (is_numeric($value)) {
33            return (float)$value;
34        }
35        log_error("Invalid float value: ".$value);
36    }
37    elseif (in_array($parameter_id, $strings)) {
38        // make sure $value is of type string
39        if (is_string($value)) {
40            return $value;
41        }
42        log_error("Invalid string value: ".$value);
43    }
44
45    log_error("Unknown parameter id: \"{$parameter_id}\". "
46              ."Value is: \"{$value}\".");
47}
48
49?>
Note: See TracBrowser for help on using the repository browser.