~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to question/type/multianswer/question.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        return $fractionsum / $fractionmax;
113
113
    }
114
114
 
 
115
    public function get_max_fraction() {
 
116
        $fractionsum = 0;
 
117
        $fractionmax = 0;
 
118
        foreach ($this->subquestions as $i => $subq) {
 
119
            $fractionmax += $subq->defaultmark;
 
120
            $fractionsum += $subq->defaultmark * $subq->get_max_fraction();
 
121
        }
 
122
        return $fractionsum / $fractionmax;
 
123
    }
 
124
 
115
125
    public function get_expected_data() {
116
126
        $expected = array();
117
127
        foreach ($this->subquestions as $i => $subq) {
140
150
        return $right;
141
151
    }
142
152
 
 
153
    public function prepare_simulated_post_data($simulatedresponse) {
 
154
        $postdata = array();
 
155
        foreach ($this->subquestions as $i => $subq) {
 
156
            $substep = $this->get_substep(null, $i);
 
157
            foreach ($subq->prepare_simulated_post_data($simulatedresponse[$i]) as $name => $value) {
 
158
                $postdata[$substep->add_prefix($name)] = $value;
 
159
            }
 
160
        }
 
161
        return $postdata;
 
162
    }
 
163
 
143
164
    public function is_complete_response(array $response) {
144
165
        foreach ($this->subquestions as $i => $subq) {
145
166
            $substep = $this->get_substep(null, $i);