Merge branch 'MDL-87149-501' of https://github.com/junpataleta/moodle into MOODLE_501_STABLE

This commit is contained in:
Mihail Geshoski
2025-11-26 17:29:32 +08:00
6 changed files with 38 additions and 22 deletions
@@ -282,9 +282,6 @@ class mod_feedback_complete_form extends moodleform {
*/
protected function get_suggested_class($item) {
$class = "feedback_itemlist feedback-item-{$item->typ}";
if ($item->dependitem) {
$class .= " feedback_is_dependent";
}
if ($item->typ !== 'pagebreak') {
$itemobj = feedback_get_item_class($item->typ);
if ($itemobj->get_hasvalue()) {
@@ -19,16 +19,14 @@ Feature: Preview feedback questions
| editingteacher | C1 | editingteacher |
| teacher | C1 | teacher |
And the following "activities" exist:
| activity | name | course | idnumber |
| feedback | Music history | C1 | feedback0 |
And I am on the "Music history" "feedback activity" page logged in as editingteacher
And I navigate to "Questions" in current page administration
And I add a "Multiple choice" question to the feedback with:
| Question | What is your favourite instrument |
| Label | instrument1 |
| Multiple choice type | Multiple choice - single answer |
| Multiple choice values | drums\guitar\hurdygurdy |
And I log out
| activity | name | course | idnumber |
| feedback | Music history | C1 | feedback0 |
And the following "mod_feedback > question" exists:
| activity | feedback0 |
| name | What is your favourite instrument |
| questiontype | multichoice |
| label | instrument1 |
| values | Drums\nGuitar\nHurdy-gurdy |
Scenario: Students cannot see the Preview questions button
When I am on the "Music history" "feedback activity" page logged in as student
@@ -45,3 +43,20 @@ Feature: Preview feedback questions
Then I should see "Preview questions"
And I follow "Preview questions"
And I should see "What is your favourite instrument"
@javascript @accessibility
Scenario: Feedback questionnaire pages should be accessible
Given the following "mod_feedback > question" exists:
| activity | feedback0 |
| name | What type of guitar is your favourite? |
| questiontype | multichoice |
| label | whatguitar |
| dependitem | instrument1 |
| dependvalue | Guitar |
| values | Electric\nAcoustic\nBass |
When I am on the "Music history" "feedback activity" page logged in as editingteacher
And I navigate to "Questions" in current page administration
Then the "region-main" "region" should meet accessibility standards with "best-practice" extra tests
And I am on the "Music history" "feedback activity" page logged in as student
And I follow "Answer the questions"
And the "region-main" "region" should meet accessibility standards with "best-practice" extra tests
@@ -103,6 +103,19 @@ class mod_feedback_generator extends testing_module_generator {
$data['values'] = $this->format_item_values($questiontype, $data['values']);
}
if (isset($data['dependitem'])) {
$select = 'label = ? OR name = ?';
$params = [
$data['dependitem'],
$data['dependitem'],
];
$dependid = $DB->get_field_select('feedback_item', 'id', $select, $params, MUST_EXIST);
$data['dependitem'] = $dependid;
} else {
// Make sure `dependvalue` is not set if we are not creating a dependent item.
unset($data['dependvalue']);
}
return call_user_func([$this, "create_item_{$questiontype}"], $feedback, $data);
}
@@ -1549,9 +1549,6 @@ $popout-header-height: 4rem;
span.feedback_info {
font-weight: bold;
}
div.feedback_is_dependent {
background: $gray-600;
}
span.feedback_depend {
color: $danger;
}
-3
View File
@@ -36837,9 +36837,6 @@ img.userpicture {
.path-mod-feedback span.feedback_info {
font-weight: bold;
}
.path-mod-feedback div.feedback_is_dependent {
background: #6a737b;
}
.path-mod-feedback span.feedback_depend {
color: #ca3120;
}
-3
View File
@@ -36837,9 +36837,6 @@ img.userpicture {
.path-mod-feedback span.feedback_info {
font-weight: bold;
}
.path-mod-feedback div.feedback_is_dependent {
background: #6a737b;
}
.path-mod-feedback span.feedback_depend {
color: #ca3120;
}