The Finish Screen setting controls what a student sees when they complete a MiniLesson attempt (and when they come back to a lesson they have already completed). It is set per activity, with a site-wide default.
Where to find it
| Level | Location |
|---|---|
| Site default | Site administration > Plugins > Activity modules > MiniLesson (settings page), under the Finish Screen heading. Two settings: Finish Screen (default: Full) and Custom finish screen (default template, see below). |
| Per activity | The activity settings form. Finish Screen is a dropdown, and Custom finish screen is a textarea that only appears when Custom is selected. New activities start with the site defaults. |
Finish screen options
| Option | Value | What the student sees |
|---|---|---|
| Full (site default) | 0 | Total score as a percentage, five stars, a See All Results button that expands a per-item breakdown, then Back to Course Page and Try Again buttons (when allowed). |
| Simple | 1 | Same as Full but without the per-item breakdown: only the total score, stars and the action buttons. |
| Custom | 2 | Your own Mustache template replaces the whole screen. The per-item results are available to the template as {{#results}}. |
Notes:
- Teachers viewing a report always get the Full layout, whatever this setting says. A custom template is never used for the teacher report.
- Back to Course Page is only shown when the lesson is not embedded, not in a popup or embedded page layout, and the site "setup tab" option is off.
- Try Again only appears when the student is allowed another attempt (max attempts not yet used). Pressing it asks the student to confirm before starting a new attempt.
- In Full mode the per-item breakdown shows, for each graded item: its number, name, the question text, the score (
correct/total), the grade, correct and incorrect answers where the item type supplies them, an "answer details" link for item types that have one, the stars, and a community page button for item types that have one (free speaking, free writing). - Only items that carry a grade appear in the results (display-only items such as
pageare left out).
Using the Custom option
Choose Custom and write the template in the Custom finish screen textarea. It is a Mustache template: {{variable}} outputs a value (HTML-escaped), {{{variable}}} outputs raw HTML, and {{#name}}...{{/name}} is a section that repeats for each entry of a list, or shows once if the value is true. {{^name}}...{{/name}} is the inverse (shows when the value is missing or empty).
The template can contain HTML, Bootstrap classes and Font Awesome icons (fa fa-star, fa fa-star-o).
Moodle's string helper also works: {{#str}} tryagain, mod_minilesson {{/str}}.
Variables available (top level):
Top level
| Variable | Type | Description |
|---|---|---|
{{total}} | number | The overall score, 0 to 100 (no % sign, add your own). |
{{coursename}} | text | Full name of the course. |
{{courseurl}} | URL | Link to the course page, at the section holding the activity. Use triple braces. |
{{reattempturl}} | URL | Link to start a new attempt. Only set if the student may retry, so wrap it in a section. Use triple braces. |
{{#backtocourse}} | true/absent | True when a "back to course" link is appropriate (not embedded, not a popup). |
{{#yellowstars}} | list (5 max) | Repeat once per earned star. |
{{#graystars}} | list | Repeat once per star not earned. Yellow plus gray always equals five. |
{{#results}} | list | One entry per graded item. See below. |
{{#showfullresults}} | true | Set for Full and Custom. |
Star thresholds, for the total and for each item:
- 0 = no stars
- 1 to 18 = 1 star
- 19 to 38 = 2
- 39 to 58 = 3
- 59 to 78 = 4
- 79 and above = 5.
Variables available inside {{#results}} (one entry per graded item)
| Variable | Type | Description |
|---|---|---|
{{index}} | number | Item position, counted from 1 (graded items only). |
{{title}} | text | The item name. |
{{{questext}}} | HTML | The item's question/instruction text. Use triple braces. |
{{itemtype}} | text | The item type, e.g. multichoice. |
{{grade}} | number | The item's grade, 0 to 100. |
{{correctitems}} | number | Number of correct answers in the item. |
{{totalitems}} | number | Number of answerable parts in the item. |
{{#yellowstars}} / {{#graystars}} | list | Star lists for this item. |
{{#hascorrectanswer}} | true/false | Whether correct answers are available. Then {{#correctans}}{{{sentence}}}{{/correctans}}. |
{{#hasincorrectanswer}} | true/false | Whether the student's wrong answers are available. Then {{#incorrectans}}{{{sentence}}}{{/incorrectans}}. |
{{#hascommunitypage}} | true/false | Free speaking and free writing items with a community page. |
Inside
{{#results}},{{#yellowstars}}and{{#graystars}}refer to the item's stars.
To get the lesson's stars you must use them outside the results section.
Limitations of the Custom screen
- The template is rendered from a string, not as a normal Moodle template. The page-level extras that the built-in Full/Simple template relies on are not provided: there is no
config.wwwroot(so nopix/yellow_star.pngimages, use Font Awesome icons instead), no JavaScript block, and none of the built-in behaviour behind the See All Results button, the answer-details links, the community page button or the Try Again confirmation dialog. A plain link to{{{reattempturl}}}simply starts a new attempt. - Editing the site default does not change activities that already saved their own copy. Use the Push button to copy a template to cloned activities.
- If the template has a Mustache syntax error (e.g. an unclosed section), the finish screen will fail to render, so test after saving by completing an attempt.
Sample 1: the default template
This is what the site setting ships with. A score, stars, a row per item and a Try Again button.
{{total}} %<br />
{{#yellowstars}}<i class="fa fa-star"></i>{{/yellowstars}}{{#graystars}}<i class="fa fa-star-o"></i>{{/graystars}} <br />
<div class="container">
{{#results}}
<div class="row">
<div class="col-sm">{{title}}</div>
<div class="col-sm">{{grade}}%</div>
<div class="col-sm"> {{#yellowstars}}<i class="fa fa-star"></i>{{/yellowstars}} {{#graystars}}<i class="fa fa-star-o"></i>{{/graystars}} <br /></div>
</div>
{{/results}}
</div>
<a class ="btn btn-secondary" href="{{{reattempturl}}}">{{#str}} tryagain, mod_minilesson {{/str}}</a> <br />
Note that this default always draws the Try Again button, even if the student is out of attempts (the link is then empty). Sample 2 shows how to guard it.
Sample 2: friendly message, guarded buttons
<div class="text-center p-4">
<h2>Well done!</h2>
<p class="lead">You finished <strong>{{coursename}}</strong> with a score of <strong>{{total}}%</strong>.</p>
<p style="font-size: 2em; color: #f5b301;">
{{#yellowstars}}<i class="fa fa-star"></i>{{/yellowstars}}{{#graystars}}<i class="fa fa-star-o"></i>{{/graystars}}
</p>
{{#reattempturl}}
<a class="btn btn-primary" href="{{{reattempturl}}}">Have another go</a>
{{/reattempturl}}
{{#backtocourse}}
<a class="btn btn-secondary" href="{{{courseurl}}}">Back to the course</a>
{{/backtocourse}}
</div>
Sample 3: results table with correct answers
<h3>Your score: {{total}}%</h3>
<table class="table table-sm">
<thead>
<tr><th>#</th><th>Activity</th><th>Result</th><th>Grade</th><th></th></tr>
</thead>
<tbody>
{{#results}}
<tr>
<td>{{index}}</td>
<td>{{title}}</td>
<td>{{correctitems}} / {{totalitems}}</td>
<td>{{grade}}%</td>
<td>
{{#yellowstars}}<i class="fa fa-star text-warning"></i>{{/yellowstars}}{{#graystars}}<i class="fa fa-star-o text-muted"></i>{{/graystars}}
</td>
</tr>
{{#hascorrectanswer}}
<tr>
<td></td>
<td colspan="4" class="small text-muted">
Correct: {{#correctans}}{{{sentence}}}{{/correctans}}
</td>
</tr>
{{/hascorrectanswer}}
{{/results}}
</tbody>
</table>
Sample 4: Star messages
Mustache has no comparisons, so the message cannot depend on total directly.
<h3>{{total}}%</h3>
{{^yellowstars}}<p>Don't give up, try again!</p>{{/yellowstars}}
{{#yellowstars}}<i class="fa fa-star"></i>{{/yellowstars}}{{#graystars}}<i class="fa fa-star-o"></i>{{/graystars}}
This only separates "no stars at all" from "some stars". There is currently no easy way to give messages per score band