Conversation
Declare MOD_PURPOSE_INTERACTIVECONTENT as primary purpose and, on Moodle 5.1+, MOD_PURPOSE_ASSESSMENT as secondary purpose, like mod_h5pactivity and mod_lesson. FEATURE_MOD_OTHERPURPOSE is checked with defined() before the switch, since 4.5 and 5.0 do not define it. The branded icon keeps the purpose from tinting it. Supersedes DEC-37-01. Related to exelearning/exelearning#2454.
On Moodle 4.5 and 5.0 the activity chooser fills its Activities tab with archetype 0 (MOD_ARCHETYPE_OTHER) only. MOD_ARCHETYPE_ASSIGNMENT (2) kept eXeLearning out of it, visible under All only. Core uses the constant for nothing else, so drop it like SCORM, H5P and Lesson do.
The proposal lives in exelearning/exelearning#2454; this repository has no matching issue, so the decision takes the PR number (DEC-159-01).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
=========================================
Coverage 93.92% 93.92%
Complexity 810 810
=========================================
Files 46 46
Lines 3554 3554
=========================================
Hits 3338 3338
Misses 216 216
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The early return only ran on Moodle 5.1+, while coverage is measured on 5.0, so the patch showed an uncovered line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eXeLearning activities now appear in the activity chooser next to SCORM, H5P and Lesson:
MOD_PURPOSE_INTERACTIVECONTENT;MOD_PURPOSE_ASSESSMENT, like H5P and Lesson;MOD_ARCHETYPE_ASSIGNMENT.The last point fixes a visible bug found while reproducing: on Moodle 4.5 and 5.0 the module was missing from the chooser's "Activities" tab and only showed under "All".
Original issue
Related to exelearning/exelearning#2454.
Why
DEC-37-01comparedASSESSMENTonly withRESOURCE/CONTENT. Core's closest modules useINTERACTIVECONTENT. Since PR 142 the icon is branded, so the purpose no longer tints it; it only decides where the module is listed.archetype === 0and "Resources"archetype === 1(course/amd/src/activitychooser.js:261-262).MOD_ARCHETYPE_ASSIGNMENTis2, so the module fell into neither. Core uses that constant for nothing else, so the group and completion defaults thatDEC-37-01attributed to it come from the module's own features. Assignment, SCORM, H5P and Lesson all use the default archetype.FEATURE_MOD_OTHERPURPOSEexists only from 5.1 (public/lib/moodlelib.php:488onMOODLE_501_STABLE). It is checked withdefined()before theswitch: as acaseit would be evaluated for any unmatched feature and throw on 4.5 and 5.0.New ADR
DEC-159-01supersedesDEC-37-01(the old one is kept, marked Superseded).TDD
RED
tests/supports_test.phpon the oldlib.php:GREEN
CI covers the 5.1/5.2 branch of the secondary-purpose test.
How to test
Screenshots (Moodle 5.0.7, "Activities" tab)
Before
After
Notes
version.php:2026092613, so Moodle refreshes the cached chooser items on upgrade.Moodle Playground Preview
The changes in this pull request can be previewed and tested using a Moodle Playground instance.
ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELPX upload, viewer and preview work normally.