[Userscript] Self-Study Quiz

Thank you @Abstormal @ekg

@rfindley

I plan to include all filters ever developed in Item Inspector via @ require directives. This causes a massive quantity of filters to be in the register. There are 64 of them. They will all load in Self Study Quiz in the filter page of the settings in some undetermined order.

There are user interface issues with this. Some of the most useful filters end up at the end of the list buried in other less useful ones. It will be hard for the users to locate the filter they need. We must control the order in which filters show up in the settings and group them into similarly themed groups.

I have written code to do this for Item Inspector and I have ported it to Self Study Quiz. The modified version is available here.

Modified Self Study Quiz

There are two major changes.

  • There are @ require directives for all available filters. you won’t need to chase them for your evaluation.

  • The function populate_items_config(config) has been modified to control the order where the filters are displayed and insert them into groups. This is the function responsible for creating the filter page in the settings.

I have the order nailed down in the const flt_ordering.object. The key is the filter name as registered. The value is a subobject with the following configuration.

  • group the identification of the group.
  • ‘order’ an integer indicating in which order the group belongs relative to other groups.
  • suborder an integer indicating in which order the filter appears within the group.

There is also the const group_labels that holds the labels for the group and the const dflt_ordering that provides the default ordering subobject for filters not categorized in flt_ordering. For now there are no such filters because I have categorized them all. But should a filter be developed in the future it will show up at the end of the list in a group called ‘Other Filters’.

Outline of the code:

  • It iterates over the filters in the registry and pushes them tagged with their ordering subobject in an array.
  • Then the array is sorted.
  • Then the code iterates over the array creating the filters in the setting page. Groups are added on the fly as they are needed.

I plan to write more filters once we get the html type sorted out. I will update the categorization and send you the data.

Take your time in evaluating this. There is no rush. I will postpone this release of filters until you have made up your mind about this proposal. There will be no impact on Self Study Quiz users if you delay.

As an aside I have found that the code for wrapping the html in a row with a checkbox is in the pre_open callback of the settings dialog. I will try to fix it in Item Inspector to get the html properly inserted. Then I will adapt Self Study Quiz pre_open callback to do the same and send you the code.

I have also set me up to be able to modify a local copy of the settings module of the framework. I will see if I can do something about the callbacks.

3 Likes