mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-54987-master-fixes' of https://github.com/lameze/moodle
This commit is contained in:
commit
be5837d797
3 changed files with 8 additions and 10 deletions
|
@ -316,16 +316,20 @@ class mod_choice_renderer extends plugin_renderer_base {
|
||||||
global $OUTPUT;
|
global $OUTPUT;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$numberofuser = 0;
|
||||||
$percentageamount = 0;
|
$percentageamount = 0;
|
||||||
foreach ($choices->options as $optionid => $option) {
|
foreach ($choices->options as $optionid => $option) {
|
||||||
if($choices->numberofuser > 0) {
|
if (!empty($option->user)) {
|
||||||
$percentageamount = ((float)count($option->user) / (float)$choices->numberofuser) * 100.0;
|
$numberofuser = count($option->user);
|
||||||
|
}
|
||||||
|
if($choices->numberofuser > 0) {
|
||||||
|
$percentageamount = ((float)$numberofuser / (float)$choices->numberofuser) * 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['labels'][$count] = $option->text;
|
$data['labels'][$count] = $option->text;
|
||||||
$data['series'][$count] = count($option->user);
|
$data['series'][$count] = $numberofuser;
|
||||||
$data['series_labels'][$count] = '(' . format_float($percentageamount, 1) . '%)';
|
$data['series_labels'][$count] = '(' . format_float($percentageamount, 1) . '%)';
|
||||||
$count++;
|
$count++;
|
||||||
|
$numberofuser = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart = new \core\chart_bar();
|
$chart = new \core\chart_bar();
|
||||||
|
|
|
@ -47,12 +47,10 @@ Feature: A teacher can choose one of 4 options for publishing choice results
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
When I follow "Choice 1"
|
When I follow "Choice 1"
|
||||||
Then I should not see "Responses"
|
Then I should not see "Responses"
|
||||||
And I should not see "Graph display"
|
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
And I choose "Option 1" from "Choice 1" choice activity
|
And I choose "Option 1" from "Choice 1" choice activity
|
||||||
And I should see "Your selection: Option 1"
|
And I should see "Your selection: Option 1"
|
||||||
And I should see "Responses"
|
And I should see "Responses"
|
||||||
And I should see "Graph display"
|
|
||||||
|
|
||||||
Scenario: Show results to students only after the choice is closed
|
Scenario: Show results to students only after the choice is closed
|
||||||
Given I add a "Choice" to section "1" and I fill the form with:
|
Given I add a "Choice" to section "1" and I fill the form with:
|
||||||
|
@ -66,7 +64,6 @@ Feature: A teacher can choose one of 4 options for publishing choice results
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
When I follow "Choice 1"
|
When I follow "Choice 1"
|
||||||
Then I should not see "Responses"
|
Then I should not see "Responses"
|
||||||
And I should not see "Graph display"
|
|
||||||
And I choose "Option 1" from "Choice 1" choice activity
|
And I choose "Option 1" from "Choice 1" choice activity
|
||||||
And I log out
|
And I log out
|
||||||
And I log in as "teacher1"
|
And I log in as "teacher1"
|
||||||
|
@ -88,7 +85,6 @@ Feature: A teacher can choose one of 4 options for publishing choice results
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
And I follow "Choice 1"
|
And I follow "Choice 1"
|
||||||
And I should see "Responses"
|
And I should see "Responses"
|
||||||
And I should see "Graph display"
|
|
||||||
|
|
||||||
Scenario: Always show results to students
|
Scenario: Always show results to students
|
||||||
Given I add a "Choice" to section "1" and I fill the form with:
|
Given I add a "Choice" to section "1" and I fill the form with:
|
||||||
|
@ -102,4 +98,3 @@ Feature: A teacher can choose one of 4 options for publishing choice results
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
When I follow "Choice 1"
|
When I follow "Choice 1"
|
||||||
And I should see "Responses"
|
And I should see "Responses"
|
||||||
And I should see "Graph display"
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
|
||||||
And I follow "Choice 1"
|
And I follow "Choice 1"
|
||||||
Then I should not see "Student 1"
|
Then I should not see "Student 1"
|
||||||
And I should not see "Users who chose this option"
|
And I should not see "Users who chose this option"
|
||||||
And ".results .graph img" "css_element" should exist
|
|
||||||
|
|
||||||
Scenario: Publish full results
|
Scenario: Publish full results
|
||||||
Given I add a "Choice" to section "1" and I fill the form with:
|
Given I add a "Choice" to section "1" and I fill the form with:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue