Essay (auto-grade) question type

Jump to: navigation, search

This is a draft for the awesome Essay (auto-grade) additional plugin by Gordon Bateson currently hosted in GitHub.


The essay (autograde) question type allows an essay question response to be given a preliminary grade that is generated automatically based on one or more of the following characteristics of the response.

  • the number of words in the response
  • the number of characters in the response
  • the presence of one or more target phrases in the response

The automatic grade can be overridden by the teacher later.

Additionally, the teacher can set up grading bands that offer a non-linear grading scheme. In such a scheme, the grade awarded is that of the grading band in which the word/character count falls.

Supported Moodle branches

3.0 to 3.5

Languages available

English, Spanish, Mexican Spanish



(Re-)Create an awesome Essay (auto-grade) question

  • Write a reasonable question name (e.g. "Summer vacation essay writing")
  • For a simple question, in the question text write the following:
Write a short paragraph of 50 words or more about your summer vacation. Try to include the following phrases:
  Next OR Then
  Finally OR In the end
You will get special bonus points, if you use ALL of the above phrases
  • Type the following General feedback:
You grade is generated automatically. Your teacher may change the grade later.
  • Type the following combined feedback for any correct response:
Your essay has been marked as correct. Your teacher will review this mark later.
  • Type the following combined feedback for any partially correct response:
Good try. Please check to see if you have written enough words and include all the target phrases.
  • Type the following combined feedback for any incorrect response:
No essay was received. Please ask you teacher about how to input and submit an essay.
  • Type the following Response Template:
Type your essay here.
  • For Auto.grading:
Enable automatic grading
Type of countable items: Words
Expected number of items: 50
Show student feedback to teachers and students
Show text statistics for Words, Unique words, long words and lexical density
  • Do not show grade bands
  • Do show partial grades
Grade band [1] For 0 items award 0%
Grade band [2] For 50 or more items award 60%
  • Do NOT show target phrases
Target phrase [1] : If [First] is used, award [10% of the question grade.]
Target phrase [2] : If [Next OR Then] is used, award [10% of the question grade.]
Target phrase [1] : If [Finally] is used, award [10% of the question grade.]
Target phrase [1] : If [First AND (Next OR Then) AND Finally] is used, award [10% of the question grade.]
  • Save changes
  • Try it :)

Making an even more awesome Essay (auto-grade) question

You can change the question text to make an impresively awesome question in order to show/hide a demo essay.

In upcoming plugin versions, there will be a new functionality to choose this.

Note: The following long and seemingly complicated instruction is optional. It may seem a bit too complicated, but you really only need to copy and paste, exactly as indicated; and the result will be very awesome :-) Definitively worth trying.

For an even more awesome Essay question, in the question text, you will have to click on the advanced tools button of your editor (Atto or TinyMCE) and then click on the <> button to show HTML code and enter (copy/paste) the following HTML code inside all the shadowed block:

<p>Write a short paragraph of 50 words or more about your summer vacation. Try to include the following phrases:</p>
<li>Next OR Then</li>
<li>Finally OR In the end</li>
<p class="essayautograde_questiontext_lastline">You will get special bonus points, if you use ALL of the above phrases</p>
<script type="text/javascript">
window.addEventListener("load", function(){
    if ($("body").is("#page-mod-quiz-review")) {
                   .find(".answer .qtype_essay_response")
                   .css({"overflow":"auto", "max-width":"640px"});
    } else {
        var txt = "This summer vacation I went back to my hometown. ";
        txt += "First, I visited my grandparents and told them about my life in Kochi. ";
        txt += "Then, I went to a firework display near a large river. ";
        txt += "There many people and lots of food stalls. The fireworks were amazing. ";
        txt += "Finally, I went to a reunion with some of my old friends from high school.";
            if ($(this).find(".cheat").length==0) {
                this.appendChild(document.createTextNode(" "));
                var small = document.createElement("SMALL");
       = "bold";
       = "red";
                small.appendChild(document.createTextNode("[Show example]"));
                small.addEventListener("click", function(){
                    // Should we show or hide the example
                    if ($(this).text().match('Show')) {
                        $(this).text($(this).text().replace("Show", "Hide"));
                        $(this).css("color", "purple");
                        var newtxt = txt;
                    } else {
                        $(this).text($(this).text().replace("Hide", "Show"));
                        $(this).css("color", "red");
                        var newtxt = "";
                    // locate response element in DOM
                    var r = $(this).closest(".qtext").next(".ablock").find(".answer .qtype_essay_response");
                    var editor = null;
                    if ("[name$='_answer']")) {
                        // Plain text (i.e. no editor)
                        editor = r;
                    } else {
                        // Atto
                        editor = r.find("[contenteditable=true]");
                        if (editor.length==0) {
                            // TinyMCE
                            editor = r.find("iframe").contents().find("[contenteditable=true]");
                            if (editor.length==0) {
                                // Plain text editor
                                editor = r.find("[name$='_answer']");
                    if (editor===null || editor.length==0) {
                        return false; // shouldn't happen !!
                    if (editor.prop("tagName")=="TEXTAREA") {
                    } else {
                    return true;
// ]]>

  • Click again in the <> button to return to the normal edit mode.
  • Save the new version of the question
  • Try it, clicking on the 'Show example' and 'Hide example' text
  • Enjoy


Essay(auto-grade) question type screen 01.png

Essay(auto-grade) question type screen 02.png

Essay(auto-grade) question type screen 03.png

Essay(auto-grade) question type screen 04.png

Essay(auto-grade) question type screen 05.png

Essay(auto-grade) question type screen 06.png

See also

  • These very powerful, but more complicated to use additional plugins:
    • Preg question type - uses regular expressions (regexes) to check student's responses (though you can use it without regexes for its hinting features).
    • Regular Expression Short-Answer question type - expects the respondent to answer an "open" question with a word or a short phrase. However, the RegExp system system gives you access to a more powerful system for analyzing the student's answers with the aim of providing more relevant immediate feedback.
    • Pattern-match question type - allow the student to give an answer of up to about 20 words, which can then be automatically graded by matching the students response against a number of different patterns expressed in the PMatch syntax. The first matching pattern determines the score and the feedback.