Skip to documentation

    AI Quiz Remedial Learning

    Local Plugin
    v1.2.58
    Requirements in plugin archive

    Automatically detects wrong quiz answers and generates AI-powered micro-remediation modules. Each Revision Module includes an explanation, optional voiceover audio, optional explanatory image, and a check question with per-option feedback. Completion tracking ensures students engage with the material. See the plugin archive for release-specific requirements and feature availability.

    ⭐ Why this plugin is unlike anything else available

    Automatically generates a remedial quiz when a learner fails

    ▸ Standard Moodle remediation requires a teacher to manually create a separate quiz for students who fail, then manually enrol only those students. AI Quiz Remedial detects a failed quiz attempt, generates a new quiz with different questions at equivalent difficulty, and makes it available to only that learner — automatically.

    ▸ The remedial questions test the same competency elements as the original but in different scenarios, so students cannot pass the remedial quiz by memorising the original answers.

    ▸ Tracks remedial attempts separately from original attempts in the gradebook, giving teachers a clear picture of which students needed additional support and whether the remediation was effective.

    Close the Feedback Loop

    Instead of just showing "Incorrect", this plugin generates personalised micro-remediation for every wrong answer while the mistake is still fresh. Students get a clear explanation of the concept they missed, an optional voiceover for audio learners, an optional AI-generated image for visual learners, and a check question to confirm they now understand — all created automatically with no teacher effort.

    Automatic Detection

    Event observer catches every quiz submission and identifies wrong answers

    AI Explanations

    Clear, student-friendly explanations tailored to the specific question and wrong answer

    Optional Voiceover

    TTS audio for explanations and per-option feedback (toggle on/off)

    Optional Images

    AI-generated explanatory images to support visual learners (toggle on/off)

    Check Questions

    4-option MCQ with per-option feedback to confirm understanding

    Completion Tracking

    Module completes on correct answer or after 2 attempts — no dead ends

    How It Works

    1. Student submits a quiz — the plugin's event observer catches the attempt_submitted event instantly. This is lightweight and does not delay the quiz submission.
    2. Pending job created — a single "umbrella" job record is inserted into the local_aiqr_job table with status pending.
    3. Cron picks up the job — the scheduled task runs every 2 minutes, picks up pending jobs in FIFO order (limited by the configurable batch size, default 10).
    4. Wrong answers identified — the task loads the quiz attempt's question usage, iterates through all slots, and identifies questions where the student's fraction is less than 1.0 (i.e. not fully correct). A per-question child job is created for each.
    5. AI generation — for each wrong question, the plugin posts the question text, the student's response, and the correct answer to the LMS Labs AI service (credit-based) at https://lms-labs.com/api/quiz-remediation/generate. It generates: an explanation text, a 4-option check question with correct index, and per-option feedback text.
    6. Voiceover and images (optional) — if voiceover is enabled, TTS audio is generated for the explanation and for each feedback option. If images are enabled, an AI image is generated for the explanation. Credits are charged based on which features are active.
    7. Student plays the Revision Module — the student sees their Revision Modules listed at /local/aiquizremedial/index.php. They read the explanation, listen to the audio, view the image, answer the check question, see per-option feedback, and the module is marked complete when they answer correctly or after 2 attempts.

    Dynamic Credit Costs

    Credit cost per wrong question adjusts dynamically based on which features you enable in the plugin settings. Admins can also customise the individual cost for each feature.

    ConfigurationWhat's GeneratedCredits per Question
    Text OnlyExplanation + check question + per-option feedback2 credits (default)
    Text + VoiceoverAbove + TTS audio for explanation and each feedback option4 credits (2 + 2)
    Text + ImagesAbove (text) + AI-generated explanatory image6 credits (2 + 4)
    All FeaturesExplanation + audio + image + check question + per-option feedback with audio8 credits (2 + 2 + 4)

    Example: A student gets 5 questions wrong on a quiz with Text + Voiceover enabled. That's 5 x 4 = 20 credits consumed. Credits are charged upfront per question before generation begins. If credits run out mid-batch, remaining questions are marked as failed and can be retried once credits are topped up.

    Installation

    1. Download the plugin ZIP from the button above
    2. In Moodle™, go to Site Administration > Plugins > Install plugins and upload the ZIP file. Or extract manually so the aiquizremedial folder sits at /local/aiquizremedial/
    3. Visit Site Administration > Notifications to trigger the database upgrade — this creates the job, module, and completion tables
    4. Go to Site Administration > Plugins > Local plugins > AI Quiz Remedial Learning to configure
    5. Ensure Moodle™ cron is running — the plugin processes jobs via a scheduled task that runs every 2 minutes

    Requirements

    • Consult the plugin archive for release-specific Moodle™ requirements
    • AI Grader Central Config plugin (recommended) or manual Site ID and API Key entry
    • AI credits balance — credits are consumed per wrong question
    • Moodle™ cron running regularly (at least every 2 minutes for timely remediation)

    Configuration Guide

    1. Connection Settings

    • Navigate to Site Administration > Plugins > Local plugins > AI Quiz Remedial Learning
    • If you have the AI Grader Central Config plugin installed and configured, the Site ID and API Key fields are optional — the plugin automatically reads from Central Config first, then falls back to local settings
    • The settings page shows a status indicator: green if Central Config is active, yellow if installed but incomplete, grey if not installed
    • Without Central Config, enter your Site ID and API Key directly in these fields

    2. Feature Options

    • Enable voiceover audio — generates TTS audio for the explanation and for each feedback option on the check question. Adds 2 credits per question (configurable).
    • Enable explanatory images — generates an AI image to accompany each explanation. Adds 4 credits per question (configurable). Disabled by default.

    3. Credit Costs

    • Text generation cost — credits for the explanation text, check question, and per-option feedback (default: 2)
    • Voiceover cost — additional credits when voiceover is enabled (default: 2)
    • Image generation cost — additional credits when images are enabled (default: 4)
    • Total cost per question = text cost + voiceover cost (if enabled) + image cost (if enabled)

    4. Processing

    • Cron batch size — maximum number of pending umbrella jobs to process per cron run (default: 10). Each umbrella job can expand into multiple per-question jobs.
    • Increase for high-volume sites where many quizzes are submitted simultaneously
    • Decrease to reduce API load and spread processing over more cron cycles

    Student Experience

    My Remedial Learning Modules

    Students access their Revision Modules at /local/aiquizremedial/index.php (or filtered by course with ?courseid=X). Each module shows the quiz name, a preview of the explanation, the credit cost, and a status badge: Not Started, In Progress, or Complete.

    Revision Module Player

    When a student opens a Revision Module, they see:

    1. Explanation section — formatted HTML explanation of the concept, with optional image and audio player
    2. Quick Check section — a 4-option multiple choice question with a prompt. The student selects an answer and clicks "Check Answer"
    3. Feedback page — shows whether the answer was correct or incorrect, plus the specific feedback text for the option they chose (and optional audio). If incorrect and only 1 attempt used, they can try once more. The module completes on a correct answer or after 2 attempts.

    Completion Rules

    • Correct answer on first or second attempt = module marked Complete
    • Two incorrect attempts = module also marked Complete (no infinite loops)
    • Once complete, the check question section is hidden and replaced with a success message

    Frequently Asked Questions

    Does the plugin delay quiz submission?

    No. The event observer only creates a lightweight database record (a pending job). All AI generation happens asynchronously via the scheduled task, so the student's quiz submission is instant.

    How quickly do Revision Modules appear after a quiz?

    The scheduled task runs every 2 minutes by default. After the task picks up the job, generation takes a few seconds per question (depending on whether voiceover/images are enabled). So typically within 2-5 minutes of submitting a quiz, the Revision Modules are ready.

    What question types are supported?

    Any question type that uses Moodle™'s standard question engine and reports a fraction (score). This includes multiple choice, true/false, matching, short answer, numerical, and more. Essay questions are supported only if they have been graded (manually or by another AI plugin) at the time the cron task runs.

    What happens when a question is partially correct?

    Any question with a fraction less than 1.0 (i.e. not fully correct) triggers a Revision Module. This includes partially correct answers on multi-select or matching questions.

    What if the student runs out of credits mid-quiz?

    Credits are charged per question during the cron task. If credits run out, the remaining per-question jobs are marked as failed with an error message. Once credits are topped up, you can re-run the scheduled task manually (or wait for the next cron cycle) and the failed jobs will not auto-retry — a new quiz attempt submission would be needed. Check the local_aiqr_jobtable for any failed jobs.

    Can teachers see student Revision Modules?

    Yes. Users with the local/aiquizremedial:viewall capability (teachers, editing teachers, and managers by default) can view any student's Revision Modules. Students can only view their own modules via the local/aiquizremedial:viewown capability.

    Does it work with AI Grader Central Config?

    Yes. If the Central Config plugin (local_aiconfig) is installed and has a Site ID and API Key configured, this plugin automatically uses those values. The local Site ID and API Key fields in the plugin settings act as fallback overrides only.

    What data is sent to the AI API?

    For each wrong question, the plugin sends to the LMS Labs AI service (credit-based): the question text (HTML), the student's response data, the correct answer, the question type, and the quiz/course context. When voiceover or images are enabled, the explanation/feedback text is additionally sent to /api/tts/generate and/api/image/generate at lms-labs.com to produce audio and image inputs. Requests are posted tohttps://lms-labs.com/api/quiz-remediation/generate and related endpoints. Personal identifiers such as the Moodle™ user ID and course ID accompany requests for credit tracking.

    Important Notes

    • Cron must be running — Revision Modules are generated via the scheduled task, not at quiz submission time. If cron is not running, no modules will be generated.
    • Credits are consumed per wrong question — a quiz with 20 questions where 8 are wrong will consume 8 x (cost per question) credits. Monitor your credit balance for high-volume sites.
    • One Revision Module per wrong question per attempt — if a student retakes a quiz and gets the same question wrong again, a new Revision Module is generated for the new attempt (not a duplicate of the old one).
    • Voiceover is enabled by default, images are disabled by default — adjust in plugin settings to control credit consumption.

    Testing Protocol

    Follow these test cases in order after installation. Complete all Admin Setup steps before running any test cases. You will need a test student account, a quiz with multiple choice questions, and a sufficient AI credits balance (minimum 20 credits recommended for a full run).

    Cron required: Revision Modules are generated by the scheduled task, not at submission time. You must be able to trigger cron manually (Site Administration → Server → Scheduled tasks) or wait up to 2 minutes per test cycle.

    Admin Setup — Do This First
    1. Install the plugin ZIP via Site administration → Plugins → Install plugins
    2. Visit Site administration → Notifications to run the database upgrade
    3. Go to Site administration → Plugins → Local plugins → AI Quiz Remedial Learning
    4. Confirm the connection status indicator is green (Central Config active) or enter your Site ID and API Key manually
    5. Set voiceover to enabled and explanatory images to enabled — this tests the full feature set
    6. Leave batch size at the default of 10
    7. Create a quiz with at least 3 multiple choice questions. Set it to allow multiple attempts
    8. Create a test student account and enrol them in the course containing the quiz
    9. Confirm your AI credits balance covers at least 8 credits per wrong answer (text + voiceover + image cost) — minimum 24 credits for a full run
    Test Case 1 — Quiz Submission Creates a Pending Job
    Student role
    1. Log in as the test student and navigate to the quiz
    2. Start the quiz attempt and deliberately answer at least 2 questions incorrectly
    3. Submit the quiz attempt
    Expected results:
    • Quiz submission completes instantly — no delay from the plugin
    • (Admin) A row with status pending appears in the local_aiqr_job database table
    Test Case 2 — Cron Task Generates Revision Modules
    Admin role
    1. Go to Site administration → Server → Scheduled tasks
    2. Find "AI Quiz Remedial Learning Processor" in the list
    3. Click the Run now link
    4. Confirm the task completes without errors (check the output or cron log)
    Expected results:
    • The umbrella job status changes from pending to complete
    • One child job is created per wrong answer, each with status complete
    • Rows appear in the local_aiqr_module table — one per wrong question
    • Credits are deducted from your AI Grader balance (8 credits per wrong question with voiceover and images both enabled)
    Test Case 3 — Student Views Their Revision Modules
    Student role
    1. Log in as the test student
    2. Navigate to /local/aiquizremedial/index.php
    Expected results:
    • Page loads and lists Revision Modules — one row per wrong question
    • Each row shows the quiz name, a short explanation preview, and a "Not Started" status badge
    • A course filter dropdown is visible (when the student is enrolled in multiple courses)
    • The student cannot see other students' modules
    Test Case 4 — Student Completes a Revision Module (Correct Answer)
    Student role
    1. Click Start Learning Revision on any Revision Module from the list
    2. Read the explanation section — confirm an AI-generated explanatory image appears below or alongside the explanation text
    3. Press play on the audio player and confirm the voiceover narration works correctly
    4. Scroll to the Quick Check section and select the correct answer
    5. Click Check Answer
    Expected results:
    • An AI-generated explanatory image renders in the explanation section — it should visually relate to the question topic
    • The audio player loads and plays back the explanation narration without errors
    • Feedback page appears showing the correct-answer feedback text for the selected option
    • A success message confirms the module is now complete
    • Returning to the index page shows the module with a "Complete" status badge
    • Opening the completed module again hides the check question and shows the completion message; the image and audio remain visible
    Test Case 5 — Module Completes After 2 Wrong Attempts
    Student role
    1. Open a second Revision Module that is still Not Started
    2. In the Quick Check section, select an incorrect answer and click Check Answer
    3. On the feedback page, click Try Again
    4. Select another incorrect answer and click Check Answer again
    Expected results:
    • After the first wrong attempt the feedback page shows the option-specific feedback text and a "Try Again" button
    • After the second wrong attempt the module is marked Complete (no infinite loop)
    • No "Try Again" button appears after the second attempt
    • Module shows "Complete" badge on the index page
    Test Case 6 — Teacher Can View Student Revision Modules
    Teacher role
    1. Log in as a teacher or admin with the local/aiquizremedial:viewall capability
    2. Navigate to /local/aiquizremedial/index.php
    3. Use the student selector or append ?userid=X with the test student's Moodle™ user ID
    4. Click Review Module on one of the student's Revision Modules
    Expected results:
    • Teacher can see the test student's Revision Modules, including explanation previews and status badges
    • Modules show as Complete for the two completed from Test Cases 4 and 5
    • Any remaining modules show as Not Started
    • Inside the module, the Quick Check (teacher review) section shows the question and all options read-only — no form or submit button
    • The correct answer is marked (correct answer) in the options list
    • The student's completion status is shown below the options (e.g. “Student completed this check in 1 attempt(s).”)
    • No interactive radio buttons or Check Answer button visible to the teacher
    Test Case 7 — Repeat Quiz Attempt Generates New Revision Modules
    Student role
    1. Log in as the test student and take the quiz a second time, again answering at least one question incorrectly
    2. Submit the attempt, then trigger the cron task as admin (or wait 2 minutes)
    3. Return to the Revision Modules index as the student
    Expected results:
    • New Revision Modules appear for the second attempt's wrong answers — they are separate from the first attempt's modules
    • First attempt modules are unchanged (still marked Complete)
    • New modules show Not Started status
    Optional: Verify Credit Deduction
    Admin role

    Credit cost per wrong question depends on which features are active:

    ConfigurationCost per wrong question
    Text only (all optional features off)2 credits
    Text + voiceover4 credits
    Text + images6 credits
    Text + voiceover + images (this test)8 credits
    1. Note your credit balance before running a test quiz
    2. Submit the quiz with N wrong answers and run the cron task
    3. Check your credit balance in the AI Grader dashboard
    Expected results:
    • Balance decreases by exactly N × 8 credits (with both voiceover and images enabled as set up in Admin Setup)
    • Disabling images in settings and re-testing reduces the cost to N × 4 credits
    • Disabling both voiceover and images reduces the cost to N × 2 credits

    Resolved Issues

    Historical release notes are retained below; consult the plugin archive for the applicable package.

    v1.2.11
    TEACHER-REVIEW-BLANK — Teacher saw a blank interactive check question when reviewing a student's Revision Module
    Symptom

    When a teacher clicked Review Module on a student's Revision Module, the check question section displayed a blank interactive form as if the teacher were taking the module themselves. The student's actual answer and completion status were not shown.

    Root Cause

    view.php loaded the completion record for $USER->id (the teacher) rather than the student's user ID. Since the teacher had no completion record, the module appeared not started and the interactive form was shown. The teacher was also inadvertently creating a completion DB record for themselves on first visit.

    Resolution

    A $teacherview flag is set when ?userid=X is in the URL and the viewer holds the viewall capability. $subjectuserid drives the completion lookup. In teacher-review mode no new completion record is ever created; the check question section renders read-only with options listed, the correct answer highlighted, and the student's completion status (Not Started / In Progress / Complete with attempt count) shown below.

    v1.2.4
    BANNER-COUNT — Quiz Review Banner Shows Wrong Count
    Symptom

    After submitting a quiz with 2 wrong answers (out of 3 total questions), the quiz review page banner displayed: “Revision Modules Available — You have 1 question(s) to revisit” instead of the expected 2.

    Root Cause

    The banner's $pendingcount query counted only modules from child jobs with status='ready'. When a child job's AI generation failed (the inner try/catch in the cron task catches the error, marks the job status='failed', and creates no module), that wrong question had no module and was silently excluded from the count. The umbrella job was still marked ready (the outer loop continues after individual failures), so the banner was shown — but with a count of 1 instead of 2.

    Resolution

    A new $wrongcount query counts all child jobs with questionid IS NOT NULL for the current attempt, regardless of status. The displayed count uses$displaycount = $wrongcount − $completedcount, where $completedcount = $modulecount − $pendingcount. The module-based $pendingcount is still used to toggle between the pending and all-complete banner states.

    Scenarios verified correct
    • 2 wrong, 2 modules generated, 0 complete → shows 2
    • 2 wrong, 1 module generated (1 AI failure), 0 complete → shows 2 (was showing 1)
    • 2 wrong, 2 modules generated, 1 complete → shows 1
    • 2 wrong, 2 modules generated, 2 complete → all-complete banner (no count)