Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 62... Línea 62...
62
        list($value, $unit) = $ap->apply_units($x);
62
        list($value, $unit) = $ap->apply_units($x);
63
        return !is_null($value) && !$unit;
63
        return !is_null($value) && !$unit;
64
    }
64
    }
Línea 65... Línea 65...
65
 
65
 
66
    public function get_question_options($question) {
66
    public function get_question_options($question) {
67
        global $CFG, $DB, $OUTPUT;
67
        global $DB;
68
        parent::get_question_options($question);
68
        parent::get_question_options($question);
69
        // Get the question answers and their respective tolerances
69
        // Get the question answers and their respective tolerances
70
        // Note: question_numerical is an extension of the answer table rather than
70
        // Note: question_numerical is an extension of the answer table rather than
71
        //       the question table as is usually the case for qtype
71
        //       the question table as is usually the case for qtype
-
 
72
        //       specific tables.
72
        //       specific tables.
73
        // If the numerical record is missing for some reason (e.g. MDL-85721), use a default tolerance.
-
 
74
        if (!$question->options->answers = $DB->get_records_sql(
73
        if (!$question->options->answers = $DB->get_records_sql(
75
            "
74
                                "SELECT a.*, n.tolerance " .
76
                SELECT a.*, COALESCE(n.tolerance, '0') AS tolerance
75
                                "FROM {question_answers} a, " .
77
                  FROM {question_answers} a
76
                                "     {question_numerical} n " .
78
             LEFT JOIN {question_numerical} n ON a.id = n.answer
77
                                "WHERE a.question = ? " .
79
                 WHERE a.question = ?
-
 
80
              ORDER BY a.id ASC
78
                                "    AND   a.id = n.answer " .
81
            ",
-
 
82
            [$question->id],
79
                                "ORDER BY a.id ASC", array($question->id))) {
83
        )) {
80
            echo $OUTPUT->notification('Error: Missing question answer for numerical question ' .
84
            debugging('Error: Missing question answer for numerical question ' .
81
                    $question->id . '!');
-
 
82
            return false;
85
                    $question->id . '!');
Línea 83... Línea 86...
83
        }
86
        }
84
 
87