Skip to content

List eXeLearning as interactive content in the activity chooser - #159

Open
erseco wants to merge 4 commits into
mainfrom
feature/2454-interactive-content-purpose
Open

erseco wants to merge 4 commits into
mainfrom
feature/2454-interactive-content-purpose

Conversation

@erseco

@erseco erseco commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

eXeLearning activities now appear in the activity chooser next to SCORM, H5P and Lesson:

  • primary purpose MOD_PURPOSE_INTERACTIVECONTENT;
  • on Moodle 5.1+, secondary purpose MOD_PURPOSE_ASSESSMENT, like H5P and Lesson;
  • the default archetype instead of 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

  • Purpose. DEC-37-01 compared ASSESSMENT only with RESOURCE/CONTENT. Core's closest modules use INTERACTIVECONTENT. Since PR 142 the icon is branded, so the purpose no longer tints it; it only decides where the module is listed.
  • Archetype (the open question in the issue). The 4.5/5.0 chooser builds its tabs by archetype: "Activities" is archetype === 0 and "Resources" archetype === 1 (course/amd/src/activitychooser.js:261-262). MOD_ARCHETYPE_ASSIGNMENT is 2, so the module fell into neither. Core uses that constant for nothing else, so the group and completion defaults that DEC-37-01 attributed to it come from the module's own features. Assignment, SCORM, H5P and Lesson all use the default archetype.
  • Compatibility. FEATURE_MOD_OTHERPURPOSE exists only from 5.1 (public/lib/moodlelib.php:488 on MOODLE_501_STABLE). It is checked with defined() before the switch: as a case it would be evaluated for any unmatched feature and throw on 4.5 and 5.0.

New ADR DEC-159-01 supersedes DEC-37-01 (the old one is kept, marked Superseded).

TDD

RED

tests/supports_test.php on the old lib.php:

1) supports_test::test_supports_reports_interactive_content_classification
Failed asserting that two strings are identical.
-'interactivecontent'
+'assessment'

GREEN

vendor/bin/phpunit mod/exelearning/tests/supports_test.php → 4 tests OK (1 skipped on 5.0: OTHERPURPOSE needs 5.1+)
vendor/bin/phpcs --standard=moodle lib.php tests/supports_test.php → 0 errors, 0 warnings
make architecture-check → OK
make check-version → OK

CI covers the 5.1/5.2 branch of the secondary-purpose test.

How to test

  1. As a teacher, turn on edit mode in a course and open Add an activity or resource.
  2. Moodle 4.5/5.0: eXeLearning resource is listed under the Activities tab.
  3. Moodle 5.1+: it is listed under Interactive content and also under Assessment.
  4. The icon keeps its official colour.

Screenshots (Moodle 5.0.7, "Activities" tab)

Before

2454-before.png

After

2454-after.png

Notes

  • Existing sites: the module moves to a different chooser category. No data changes.
  • 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.

Preview in Moodle Playground

ℹ️ 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.

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.
@erseco erseco added the enhancement New feature or request label Sep 28, 2026
@erseco erseco self-assigned this Sep 28, 2026
The proposal lives in exelearning/exelearning#2454; this repository has no
matching issue, so the decision takes the PR number (DEC-159-01).
@codecov-commenter

codecov-commenter commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.92%. Comparing base (48a82fc) to head (5ff8ea0).
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
javascript 96.00% <ø> (ø)
php 93.83% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
PHP (server-side) 93.83% <100.00%> (ø)
JavaScript (SCORM tracker) 96.00% <ø> (ø)
Files with missing lines Coverage Δ
lib.php 83.58% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The early return only ran on Moodle 5.1+, while coverage is measured on
5.0, so the patch showed an uncovered line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants