Commit 8d166d77 authored by Davo Smith's avatar Davo Smith Committed by Davo Smith
Browse files

MDL-66017 block_myoverview: filter by custom course field

parent a31719f9
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -102,6 +102,8 @@ function(
grouping: courseRegion.attr('data-grouping'),
sort: courseRegion.attr('data-sort'),
displaycategories: courseRegion.attr('data-displaycategories'),
customfieldname: courseRegion.attr('data-customfieldname'),
customfieldvalue: courseRegion.attr('data-customfieldvalue'),
};
};
......@@ -126,7 +128,9 @@ function(
offset: courseOffset,
limit: limit,
classification: filters.grouping,
sort: filters.sort
sort: filters.sort,
customfieldname: filters.customfieldname,
customfieldvalue: filters.customfieldvalue
});
};
......
......@@ -55,6 +55,8 @@ function(
type = 'block_myoverview_user_view_preference';
} else if (filter == 'sort') {
type = 'block_myoverview_user_sort_preference';
} else if (filter == 'customfieldvalue') {
type = 'block_myoverview_user_grouping_customfieldvalue_preference';
} else {
type = 'block_myoverview_user_grouping_preference';
}
......@@ -92,10 +94,16 @@ function(
var filter = option.attr('data-filter');
var pref = option.attr('data-pref');
var customfieldvalue = option.attr('data-customfieldvalue');
root.find(Selectors.courseView.region).attr('data-' + filter, option.attr('data-value'));
updatePreferences(filter, pref);
if (customfieldvalue) {
root.find(Selectors.courseView.region).attr('data-customfieldvalue', customfieldvalue);
updatePreferences('customfieldvalue', customfieldvalue);
}
// Reset the views.
View.init(root);
......
......@@ -53,8 +53,9 @@ class block_myoverview extends block_base {
$sort = get_user_preferences('block_myoverview_user_sort_preference');
$view = get_user_preferences('block_myoverview_user_view_preference');
$paging = get_user_preferences('block_myoverview_user_paging_preference');
$customfieldvalue = get_user_preferences('block_myoverview_user_grouping_customfieldvalue_preference');
$renderable = new \block_myoverview\output\main($group, $sort, $view, $paging);
$renderable = new \block_myoverview\output\main($group, $sort, $view, $paging, $customfieldvalue);
$renderer = $this->page->get_renderer('block_myoverview');
$this->content = new stdClass();
......
......@@ -130,6 +130,27 @@ class main implements renderable, templatable {
*/
private $displaygroupinghidden;
/**
* Store a course grouping option setting.
*
* @var bool
*/
private $displaygroupingcustomfield;
/**
* Store the custom field used by customfield grouping.
*
* @var string
*/
private $customfiltergrouping;
/**
* Store the selected custom field value to group by.
*
* @var string
*/
private $customfieldvalue;
/**
* main constructor.
* Initialize the user preferences
......@@ -137,10 +158,12 @@ class main implements renderable, templatable {
* @param string $grouping Grouping user preference
* @param string $sort Sort user preference
* @param string $view Display user preference
* @param int $paging
* @param string $customfieldvalue
*
* @throws \dml_exception
*/
public function __construct($grouping, $sort, $view, $paging) {
public function __construct($grouping, $sort, $view, $paging, $customfieldvalue = null) {
// Get plugin config.
$config = get_config('block_myoverview');
......@@ -153,28 +176,14 @@ class main implements renderable, templatable {
// Otherwise fall back to another grouping in a reasonable order.
// This is done to prevent one-time UI glitches in the case when a user has chosen a grouping option previously which
// was then disabled by the admin in the meantime.
} else if ($config->displaygroupingall == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_ALL;
} else if ($config->displaygroupingallincludinghidden == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_ALLINCLUDINGHIDDEN;
} else if ($config->displaygroupinginprogress == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_INPROGRESS;
} else if ($config->displaygroupingfuture == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_FUTURE;
} else if ($config->displaygroupingpast == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_PAST;
} else if ($config->displaygroupingstarred == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_FAVOURITES;
} else if ($config->displaygroupinghidden == true) {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_HIDDEN;
// In this case, no grouping option is enabled and the grouping is not needed at all.
// But it's better not to leave $this->grouping unset for any unexpected case.
} else {
$this->grouping = BLOCK_MYOVERVIEW_GROUPING_ALLINCLUDINGHIDDEN;
$this->grouping = $this->get_fallback_grouping($config);
}
unset ($groupingconfigname);
// Remember which custom field value we were using, if grouping by custom field.
$this->customfieldvalue = $customfieldvalue;
// Check and remember the given sorting.
$this->sort = $sort ? $sort : BLOCK_MYOVERVIEW_SORTING_TITLE;
......@@ -207,6 +216,8 @@ class main implements renderable, templatable {
$this->displaygroupingpast = $config->displaygroupingpast;
$this->displaygroupingstarred = $config->displaygroupingstarred;
$this->displaygroupinghidden = $config->displaygroupinghidden;
$this->displaygroupingcustomfield = ($config->displaygroupingcustomfield && $config->customfiltergrouping);
$this->customfiltergrouping = $config->customfiltergrouping;
// Check and remember if the grouping selector should be shown at all or not.
// It will be shown if more than 1 grouping option is enabled.
......@@ -218,7 +229,7 @@ class main implements renderable, templatable {
$this->displaygroupingstarred,
$this->displaygroupinghidden);
$displaygroupingselectorscount = count(array_filter($displaygroupingselectors));
if ($displaygroupingselectorscount > 1) {
if ($displaygroupingselectorscount > 1 || $this->displaygroupingcustomfield) {
$this->displaygroupingselector = true;
} else {
$this->displaygroupingselector = false;
......@@ -226,6 +237,41 @@ class main implements renderable, templatable {
unset ($displaygroupingselectors, $displaygroupingselectorscount);
}
/**
* Determine the most sensible fallback grouping to use (in cases where the stored selection
* is no longer available).
* @param object $config
* @return string
*/
private function get_fallback_grouping($config) {
if ($config->displaygroupingall == true) {
return BLOCK_MYOVERVIEW_GROUPING_ALL;
}
if ($config->displaygroupingallincludinghidden == true) {
return BLOCK_MYOVERVIEW_GROUPING_ALLINCLUDINGHIDDEN;
}
if ($config->displaygroupinginprogress == true) {
return BLOCK_MYOVERVIEW_GROUPING_INPROGRESS;
}
if ($config->displaygroupingfuture == true) {
return BLOCK_MYOVERVIEW_GROUPING_FUTURE;
}
if ($config->displaygroupingpast == true) {
return BLOCK_MYOVERVIEW_GROUPING_PAST;
}
if ($config->displaygroupingstarred == true) {
return BLOCK_MYOVERVIEW_GROUPING_FAVOURITES;
}
if ($config->displaygroupinghidden == true) {
return BLOCK_MYOVERVIEW_GROUPING_HIDDEN;
}
if ($config->displaygroupingcustomfield == true) {
return BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD;
}
// In this case, no grouping option is enabled and the grouping is not needed at all.
// But it's better not to leave $this->grouping unset for any unexpected case.
return BLOCK_MYOVERVIEW_GROUPING_ALLINCLUDINGHIDDEN;
}
/**
* Set the available layouts based on the config table settings,
......@@ -292,6 +338,49 @@ class main implements renderable, templatable {
}
/**
* Get the list of values to add to the grouping dropdown
* @return object[] containing name, value and active fields
*/
public function get_customfield_values_for_export() {
global $DB, $USER;
if (!$this->displaygroupingcustomfield) {
return [];
}
$fieldid = $DB->get_field('customfield_field', 'id', ['shortname' => $this->customfiltergrouping]);
if (!$fieldid) {
return [];
}
$courses = enrol_get_all_users_courses($USER->id, true);
if (!$courses) {
return [];
}
list($csql, $params) = $DB->get_in_or_equal(array_keys($courses), SQL_PARAMS_NAMED);
$select = "instanceid $csql AND fieldid = :fieldid";
$params['fieldid'] = $fieldid;
$values = $DB->get_records_select_menu('customfield_data', $select, $params, 'value',
'DISTINCT value, value AS value2');
$values = array_filter($values);
if (!$values) {
return [];
}
$field = \core_customfield\field_controller::create($fieldid);
if (!$field->supports_course_grouping()) {
return []; // The field shouldn't have been selectable in the global settings, but just skip it now.
}
$values = $field->course_grouping_format_values($values);
$customfieldactive = ($this->grouping === BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD);
$ret = [];
foreach ($values as $value => $name) {
$ret[] = (object)[
'name' => $name,
'value' => $value,
'active' => ($customfieldactive && ($this->customfieldvalue == $value)),
];
}
return $ret;
}
/**
* Export this data so it can be used as the context for a mustache template.
*
......@@ -305,6 +394,29 @@ class main implements renderable, templatable {
$nocoursesurl = $output->image_url('courses', 'block_myoverview')->out();
$customfieldvalues = $this->get_customfield_values_for_export();
$selectedcustomfield = '';
if ($this->grouping == BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD) {
foreach ($customfieldvalues as $field) {
if ($field->value == $this->customfieldvalue) {
$selectedcustomfield = $field->name;
break;
}
}
// If the selected custom field value has not been found (possibly because the field has
// been changed in the settings) find a suitable fallback.
if (!$selectedcustomfield) {
$this->grouping = $this->get_fallback_grouping(get_config('block_myoverview'));
if ($this->grouping == BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD) {
// If the fallback grouping is still customfield, then select the first field.
$firstfield = reset($customfieldvalues);
if ($firstfield) {
$selectedcustomfield = $firstfield->name;
$this->customfieldvalue = $firstfield->value;
}
}
}
}
$preferences = $this->get_preferences_as_booleans();
$availablelayouts = $this->get_formatted_available_layouts_for_export();
......@@ -327,8 +439,13 @@ class main implements renderable, templatable {
'displaygroupingstarred' => $this->displaygroupingstarred,
'displaygroupinghidden' => $this->displaygroupinghidden,
'displaygroupingselector' => $this->displaygroupingselector,
'displaygroupingcustomfield' => $this->displaygroupingcustomfield && $customfieldvalues,
'customfieldname' => $this->customfiltergrouping,
'customfieldvalue' => $this->customfieldvalue,
'customfieldvalues' => $customfieldvalues,
'selectedcustomfield' => $selectedcustomfield,
];
return array_merge($defaultvariables, $preferences);
}
}
\ No newline at end of file
}
......@@ -33,6 +33,7 @@ $string['aria:controls'] = 'Course overview controls';
$string['aria:courseactions'] = 'Actions for current course';
$string['aria:coursesummary'] = 'Course summary text:';
$string['aria:courseprogress'] = 'Course progress:';
$string['aria:customfield'] = 'Show {$a} courses';
$string['aria:displaydropdown'] = 'Display drop-down menu';
$string['aria:favourites'] = 'Show starred courses';
$string['aria:future'] = 'Show future courses';
......@@ -51,6 +52,9 @@ $string['card'] = 'Card';
$string['cards'] = 'Cards';
$string['courseprogress'] = 'Course progress:';
$string['completepercent'] = '{$a}% complete';
$string['customfield'] = 'Custom field';
$string['customfiltergrouping'] = 'Field to use';
$string['customfiltergrouping_nofields'] = 'You need to add at least one course custom field in order to use this setting';
$string['displaycategories'] = 'Display categories';
$string['displaycategories_help'] = 'Display the course category on dashboard course items including cards, list items and summary items.';
$string['favourites'] = 'Starred';
......@@ -61,6 +65,7 @@ $string['layouts'] = 'Available layouts';
$string['layouts_help'] = 'Course overview layouts which are available for selection by users. If none are selected, the card layout will be used.';
$string['list'] = 'List';
$string['myoverview:myaddinstance'] = 'Add a new course overview block to Dashboard';
$string['nocustomvalue'] = 'No {$a}';
$string['past'] = 'Past';
$string['pluginname'] = 'Course overview';
$string['privacy:metadata:overviewsortpreference'] = 'The Course overview block sort preference.';
......
......@@ -34,6 +34,12 @@ define('BLOCK_MYOVERVIEW_GROUPING_FUTURE', 'future');
define('BLOCK_MYOVERVIEW_GROUPING_PAST', 'past');
define('BLOCK_MYOVERVIEW_GROUPING_FAVOURITES', 'favourites');
define('BLOCK_MYOVERVIEW_GROUPING_HIDDEN', 'hidden');
define('BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD', 'customfield');
/**
* Allows selection of all courses without a value for the custom field.
*/
define('BLOCK_MYOVERVIEW_CUSTOMFIELD_EMPTY', -1);
/**
* Constants for the user preferences sorting options
......@@ -81,9 +87,17 @@ function block_myoverview_user_preferences() {
BLOCK_MYOVERVIEW_GROUPING_FUTURE,
BLOCK_MYOVERVIEW_GROUPING_PAST,
BLOCK_MYOVERVIEW_GROUPING_FAVOURITES,
BLOCK_MYOVERVIEW_GROUPING_HIDDEN
BLOCK_MYOVERVIEW_GROUPING_HIDDEN,
BLOCK_MYOVERVIEW_GROUPING_CUSTOMFIELD,
)
);
$preferences['block_myoverview_user_grouping_customfieldvalue_preference'] = [
'null' => NULL_ALLOWED,
'default' => null,
'type' => PARAM_RAW,
];
$preferences['block_myoverview_user_sort_preference'] = array(
'null' => NULL_NOT_ALLOWED,
'default' => BLOCK_MYOVERVIEW_SORTING_TITLE,
......
......@@ -86,6 +86,29 @@ if ($ADMIN->fulltree) {
'',
1));
$settings->add(new admin_setting_configcheckbox(
'block_myoverview/displaygroupingcustomfield',
get_string('customfield', 'block_myoverview'),
'',
0));
$choices = \core_customfield\api::get_fields_supporting_course_grouping();
if ($choices) {
$choices = ['' => get_string('choosedots')] + $choices;
$settings->add(new admin_setting_configselect(
'block_myoverview/customfiltergrouping',
get_string('customfiltergrouping', 'block_myoverview'),
'',
'',
$choices));
} else {
$settings->add(new admin_setting_configempty(
'block_myoverview/customfiltergrouping',
get_string('customfiltergrouping', 'block_myoverview'),
get_string('customfiltergrouping_nofields', 'block_myoverview')));
}
$settings->hide_if('block_myoverview/customfiltergrouping', 'block_myoverview/displaygroupingcustomfield');
$settings->add(new admin_setting_configcheckbox(
'block_myoverview/displaygroupingstarred',
get_string('favourites', 'block_myoverview'),
......
......@@ -31,6 +31,8 @@
data-region="courses-view"
data-display="{{view}}"
data-grouping="{{grouping}}"
data-customfieldname="{{customfieldname}}"
data-customfieldvalue="{{customfieldvalue}}"
data-sort="{{sort}}"
data-prev-display="{{view}}"
data-paging="{{paging}}"
......@@ -40,4 +42,4 @@
<div data-region="course-view-content">
{{> block_myoverview/placeholders }}
</div>
</div>
\ No newline at end of file
</div>
......@@ -50,6 +50,7 @@
{{#past}}{{#str}} past, block_myoverview {{/str}}{{/past}}
{{#favourites}}{{#str}} favourites, block_myoverview {{/str}}{{/favourites}}
{{#hidden}}{{#str}} hiddencourses, block_myoverview {{/str}}{{/hidden}}
{{selectedcustomfield}}
</span>
</button>
<ul class="dropdown-menu" data-show-active-item data-active-item-text aria-labelledby="groupingdropdown">
......@@ -106,6 +107,21 @@
</a>
</li>
{{/displaygroupingpast}}
{{#displaygroupingcustomfield}}
<li class="dropdown-divider" role="presentation">
<span class="filler">&nbsp;</span>
</li>
{{#customfieldvalues}}
<li>
<a class="dropdown-item {{#active}}active{{/active}}" href="#" data-filter="grouping"
data-value="customfield" data-pref="customfield" data-customfieldvalue="{{value}}"
aria-label="{{#str}}aria:customfield, block_myoverview, {{name}}{{/str}}"
aria-controls="courses-view-{{uniqid}}">
{{name}}
</a>
</li>
{{/customfieldvalues}}
{{/displaygroupingcustomfield}}
{{#displaygroupingstarred}}
<li class="dropdown-divider" role="presentation">
<span class="filler">&nbsp;</span>
......
@block @block_myoverview @javascript
Feature: The my overview block allows users to group courses by custom fields
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | X | student1@example.com | S1 |
And the following "custom field categories" exist:
| name | component | area | itemid |
| Course fields | core_course | course | 0 |
And the following "custom fields" exist:
| name | category | type | shortname | configdata |
| Checkbox field | Course fields | checkbox | checkboxfield | |
| Date field | Course fields | date | datefield | {"mindate":0, "maxdate":0} |
| Select field | Course fields | select | selectfield | {"options":"Option 1\nOption 2\nOption 3\nOption 4"} |
| Text field | Course fields | text | textfield | |
And the following "courses" exist:
| fullname | shortname | category | customfield_checkboxfield | customfield_datefield | customfield_selectfield | customfield_textfield |
| Course 1 | C1 | 0 | 1 | 981028800 | 1 | fish |
| Course 2 | C2 | 0 | 0 | 334324800 | | |
| Course 3 | C3 | 0 | 0 | 981028800 | 2 | dog |
| Course 4 | C4 | 0 | 1 | | 3 | cat |
| Course 5 | C5 | 0 | | 334411200 | 2 | fish |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
| student1 | C3 | student |
| student1 | C4 | student |
| student1 | C5 | student |
Scenario: Group courses by checkbox: Yes
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | checkboxfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Checkbox field: Yes" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by checkbox: No
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | checkboxfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Checkbox field: No" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should see "Course 5" in the "Course overview" "block"
Scenario: Group courses by date: 1 February 2001
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "1 February 2001" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by date: 6 August 1980
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "6 August 1980" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should see "Course 5" in the "Course overview" "block"
Scenario: Group courses by date: No Date field
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | datefield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Date field" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by select: Option 1
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
And I should not see "Option 4" in the "Course overview" "block"
When I click on "Option 1" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by select: Option 2
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "Option 2" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should see "Course 5" in the "Course overview" "block"
Scenario: Group courses by select: No Select field
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | selectfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Select field" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by text: fish
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "fish" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should see "Course 5" in the "Course overview" "block"
Scenario: Group courses by text: dog
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "dog" "link" in the "Course overview" "block"
Then I should not see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I should not see "Course 5" in the "Course overview" "block"
Scenario: Group courses by text: No Text field
Given the following config values are set as admin:
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield | block_myoverview |
And I log in as "student1"
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
When I click on "No Text field" "link" in the "Course overview" "block"