Search by

billsensei / moodle-local_bandedgrade

billwhite

Moodle plugin that scores a quiz by the number of fully correct questions, mapped through teacher-defined bands, and writes the score to its own gradebook item.

Package info

github.com/billsensei/moodle-local_bandedgrade

Type:moodle-local

pkg:composer/billsensei/moodle-local_bandedgrade

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.10.3 2026-11-03 05:29 UTC

This package is auto-updated.

Last update: 2026-11-03 06:13:16 UTC


README

Give each student a simple score based on how many questions they got fully right in a quiz. For example, with 10 questions: 0 correct → 0, 1–4 correct → 1, 5–8 correct → 2, 9 or 10 correct → 3.

The score appears in the gradebook as its own column, next to the quiz. You set it up in the quiz settings. There are no formulas to write.

For teachers

1. Turn it on

  1. Open your quiz and click Settings.
  2. Scroll down to the section Grade by number correct and click it to open it.
  3. Tick Grade by number correct.

2. Choose your bands

A band says: "from this many correct answers, give this score". A band lasts until the next band starts.

  • Use a ready-made set: in the Bands list, pick one, for example Scores 0 to 3: 0 correct → 0, 1–4 → 1, 5–8 → 2, 9 or more → 3. The boxes below fill in by themselves. Your Moodle administrator may have added your school's own sets to this list.

  • Or type your own: pick My own bands (type them below). Then, for each band, type the number correct it starts at and the score. The first band must start at 0. You can leave the extra rows empty.

  • Bands by percentage: in Bands are based on, choose The percentage of questions answered correctly (or pick a ready-made set that says "by percentage"). Each band then starts at a percentage, for example 50%, instead of a number of questions. Use this when quizzes of different lengths should share the same bands. The percentage is worked out from the questions the quiz has now, so adding or removing a question changes it for everyone (the same as the quiz's own grade). A student with 2 of 3 correct has 66.67%, so a band starting at 66.67 includes them. With the average grading method the average percentage is used.

  • Pass or fail: if you only need a pass or a fail, set How to give scores to Pass or fail (one pass mark). Type the pass mark (a number of correct questions, or a percentage if you change The pass mark is) and the score for a pass (1 unless you change it) and for a fail (0). Students at or above the pass mark pass; the others fail. The pass score is also set as the grade to pass of the gradebook column, so the gradebook shows pass and fail and the activity can require a passing grade. Going back to A list of bands takes that grade to pass back.

  • Questions that must be correct: under the bands, choose the questions every student has to get fully right. A student who misses any of them gets the lowest score (the first band, or the fail score), however many other questions are right. The Number correct page still shows the real number, marked "missed a required question". With several attempts, each attempt is checked first and then the quiz's grading method picks the score, so a later attempt that gets every required question right can make up for an earlier one. Leave the box empty to require none. Only questions with a mark above 0 can be chosen. A question that is deleted from the quiz stops being required.

  • Words instead of numbers (a scale): if you want the gradebook to show words such as Fail, Pass, Merit, set Scores are to one of your gradebook scales (you can make one in the gradebook under Scales). Then give each band, or the pass and fail score, a word of the scale (or its number: 1 is the first word) instead of a number. The gradebook column becomes a scale column and shows the words; the pass score is still the "grade to pass". The ready-made bands give numbers, so with a scale choose My own bands and type the words. Choose Numbers to go back. A scale can be a site scale or one of the course's own.

Under the bands, What students will get shows the result as you type, for example:

0 correct → score 0 1 to 4 correct → score 1 5 to 8 correct → score 2 9 to 10 correct → score 3

If a band can never be reached (for example, it starts at 12 but the quiz has 10 questions), the preview tells you.

Count only this score in the course total is ticked at first. The quiz's usual grade still shows in the gradebook, but only the new score counts towards the course total. If your gradebook adds grades up in a way that does not allow this, a message tells you so. Your gradebook is not changed in that case.

Click Save and return to course.

3. What students see

Nothing changes in the quiz itself. After a student finishes the quiz, their score appears in Grades, in the column "quiz name – score".

4. Where you find the scores

Grades → Grader report: the column "quiz name – score", just after the quiz.

To see how many questions each student got right, open the quiz and click More → Number correct (or use the link in the quiz settings). For each student, the page shows:

  • the number correct in each attempt (waiting for marking while an essay is not marked yet),
  • the number correct used for the score, which follows the quiz's grading method,
  • the percentage of questions answered correctly, in colour,
  • the score in the gradebook, marked Changed by hand if you changed it.

Colours. The percentage of questions answered correctly (the number correct used for the score, divided by the number of questions) is colour coded on the Number correct page, in the score column of the grader report, and in the grade column of the quiz's own Results reports (Grades and Responses), where each attempt is coloured by its own number of correct questions. Hover over a coloured cell in the grader report or the Results reports to see the percentage.

Percentage Colour
0% to 59.9% Red
60% to 69.9% Yellow
70% to 79.9% Light blue
80% to 89.9% Blue
90% to 100% Green

The percentage is rounded to one decimal first, so 59.96% is shown as 60% and is yellow. By default the colours are the same for every quiz and do not depend on your bands. A student with no count yet (for example waiting for marking) is not coloured.

Your own colours. To colour by band instead, tick Choose the report colours myself in the quiz settings and pick a colour next to each band (with the pass/fail scheme, one for a fail and one for a pass). Each grade then gets the colour of the band it falls in, in the same three places, and the Number correct page lists the band colours. The grader report shows the same colour key below its table. The text turns white on a dark colour so it stays readable. Untick the box to go back to the percentage colours.

In a quiz with separate groups, you see only the students in your groups, as in the quiz's own reports. Purge caches after upgrading so the new stylesheet loads.

If you remove questions

If the quiz has fewer questions than a band needs, for example a band starts at 9 correct but the quiz now has 8 questions, no student can reach that band. The quiz page and the Questions page then show a warning with a link to the settings. Change the bands, or add questions. Only teachers who can edit the quiz see the warning.

What counts as "correct"

  • A question counts only when it is fully right. Part marks do not count, whatever the question is worth.
  • A question with several parts (for example, "Embedded answers") counts only if every part is right.
  • A question answered right on a later try (in "Interactive with multiple tries") does count, even though the quiz takes marks off.
  • Essay questions wait until you mark them. Until then the score stays blank. When you give full marks, the essay counts as correct. Careful: if you re-mark, by hand, a question that was right on a later try and keep the lower mark, it counts as "partly right" and stops counting.
  • Description items and questions with a mark of 0 are not counted.

Several attempts

The score follows the quiz's Grading method setting:

Grading method Which attempt counts
Highest grade The attempt with the most correct answers
Average grade The average number correct. If the average falls between two bands, the lower band is used (4.5 correct with a band starting at 5 → the band below).
First attempt The first attempt
Last attempt The last attempt

Changing a score by hand

You can change the score in the gradebook as usual. Your change is kept: the plugin never replaces a score you changed, even after another attempt or a change of bands. Locked grades are never changed either.

The Recalculate page

Open the quiz, click More → Recalculate scores, or use the Recalculate scores now link in the quiz settings.

  • Recalculate, but keep the scores I changed by hand: works out every score again, but leaves your own changes alone.
  • Recalculate everything, and replace the scores I changed by hand: the page lists the students affected and asks you to confirm. This cannot be undone.

Scores update a minute or two later.

You do not normally need this page. Scores update by themselves when a student finishes, when you mark an essay, regrade, delete an attempt, change the bands, or add or remove questions.

Backups, course copies and duplicated quizzes

The settings are saved with the quiz in backups.

  • Restoring a whole course (or copying it): the bands and the score column come back. Scores, and changes you made by hand, are kept when the backup includes student data.

  • Duplicating a quiz, or importing or restoring just one quiz: the copy keeps the bands and gets its own new score column. It fills in as students take the copy.

  • Restoring a course into a course that already has its own gradebook categories: Moodle does not restore the gradebook in that case. The quiz keeps its bands and gets a new score column, filled in from the students' quiz answers. Scores you had changed by hand are not carried over, so check them afterwards.

Scores are checked again in the background shortly after a restore.

Turning it off

Untick Grade by number correct and save. The score column and its scores stay in the gradebook (delete the column there if you no longer want it), and the quiz's own grade counts again.

For administrators

Install

  • ZIP upload: Site administration → Plugins → Install plugins, upload the local_bandedgrade_<version>.zip file from the latest release, and follow the steps.

  • Manual copy: unzip into local/bandedgrade under your Moodle folder (on Moodle 5.1 or later, public/local/bandedgrade), then run php admin/cli/upgrade.php. The output should end with Command line upgrade from ... completed successfully.

  • Composer: composer require billsensei/moodle-local_bandedgrade (type moodle-local, published on Packagist). composer/installers puts the plugin in local/bandedgrade, which is right for Moodle 5.0. On Moodle 5.1 or later (web root public/) set the path yourself in the site's composer.json before running composer require:

    {
        "extra": {
            "installer-paths": {
                "public/local/bandedgrade": ["billsensei/moodle-local_bandedgrade"]
            }
        }
    }

Moodle's cron must be running. The Recalculate page and changes to bands or questions use a background task.

Your school's own bands

Site administration → Plugins → Local plugins → Grade by number correct.

  • Sets of bands: one set per line: a name, a | sign, then the bands, each written as from this many correct = score:

    Scores 0 to 3 | 0=0, 1=1, 5=2, 9=3
    Pass or fail (6 of 10) | 0=0, 6=1
    

    The same rules apply as in the quiz settings: the first band starts at 0, at most 10 bands, and at least one score above 0. At most 20 sets. If a line is wrong, the page says which line and why, and nothing is saved. To base a set on the percentage correct, write % after every band start: Scores by percentage | 0%=0, 10%=1, 50%=2, 90%=3. Percentages go from 0 to 100, with up to 2 decimals.

  • Offer the ready-made bands: untick it to offer only your own sets.

Each quiz keeps a copy of its bands. Changing or removing a set here does not change quizzes that already use it.

Capability

local/bandedgrade:recalculate lets someone use the Recalculate page. By default, editing teachers and managers have it. It is marked as a data-loss risk because "replace" overwrites scores changed by hand. The Number correct page uses the quiz's own mod/quiz:viewreports capability (teachers, non-editing teachers and managers). Its score column also needs moodle/grade:viewall, because it shows gradebook values. Turning the feature on and setting the bands needs both the right to edit the quiz settings and moodle/grade:manage (set up the gradebook) in the course.

Uninstall

Site administration → Plugins → Plugins overview, find Grade by number correct, click Uninstall. Uninstalling deletes the score columns and gives every quiz its own weight in the course total back.

Privacy

The plugin stores, per quiz attempt, the number of fully correct questions, and per student the last score it wrote. Both are covered by Moodle's privacy export and delete tools. The scores themselves are gradebook data.

Status

Version 0.10.3 is stable: it has been tried on a Moodle site and passes the automated tests on every supported Moodle version and database.

Compatibility

Moodle 5.0, 5.1, 5.2 and 5.3, PHP 8.2 or later (5.2 and 5.3 need PHP 8.3). Automated tests run on all four with MariaDB and PostgreSQL.

Changelog

See CHANGES.md for what changed in each version, newest first.