Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: question/type/essayautograde.

question/type/essayautograde

From MoodleDocs
Revision as of 01:02, 1 August 2018 by German Valero (talk | contribs) (800px|)

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

Download

Install

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

  • Write a reasonable question name (Summer vacation essay writing)
  • For the question text, you will have to click on the advanced toools button of your editor (Atto or TinyMCE) and then click on the <> button to show HTML code and enter the following HTML code

Write a short paragraph of 50 words or more about your summer vacation. Try to include the following phrases:

  • First
  • Next OR Then
  • Finally OR In the end

If you will get special bonus points, if you use ALL of the above phrases

<script type="text/javascript"> //<![CDATA[ window.addEventListener("load", function(){

   if ($("body").is("#page-mod-quiz-review")) {
       $(".essayautograde_questiontext_lastline").each(function(){
           $(this).closest(".qtext")
                  .next(".ablock")
                  .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.";
       $(".essayautograde_questiontext_lastline").each(function(){
           if ($(this).find(".cheat").length==0) {
               this.appendChild(document.createTextNode(" "));
               var small = document.createElement("SMALL");
               small.style.fontWeight = "bold";
               small.style.color = "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 (r.is("[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") {
                       editor.val(newtxt).keyup();
                   } else {
                       editor.text(newtxt).keyup();
                   }
                   return true;
               });
               this.appendChild(small);
           }
       });
   }

}); // ]]> </script>

  • Click again in the <> button to return to the normal edit mode.
  • 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 :)

Images

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