Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63877

mod_glossary: Invalid Context when rating an entry from Secondary Glossary



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.5.2, 3.6
    • None
    • Glossary


      This is to report two issues for mod_glossary.

      1. It is not possible to rate an exported entry (no rating yet) from secondary glossary to main glossary. An invalid context message is displayed.
      2. It is not possible to change the rate of an entry (with rating) from secondary glossary once exported to main glossary. An invalid context message is displayed.

      Steps to replicate.

      1. Create a course and enrol a teacher and a student.
      2. Turn editing mode on.
      3. Add a Glossary activity.
        Name: My secondary glossary
        Glossary type: Secondary glossary
        Ratings -> Aggregate type: Maximum rating
        Scale -> type: Point
        Scale -> Maximum grade: 100
      4. Add another Glossary activity. Just set the following, leave others as default:
        Name: My main glossary
        Glossary Type: Main glossary
      5. Log as the student. Go to "My secondary glossary".
      6. Click the "Add a new entry" button.
        Concept: This is my first entry.
        Definition: Do not export, but grade immediately.
      7. Save changes.
      8. Log in as the teacher. Go to "My secondary glossary".
      9. Click the Maximum rating "Rate" drop-down control and select any number (ex. 99)
        Result: The rating will be awarded correctly to the first entry.
      10. Log in once again as the student and go to "My secondary glossary".
      11. Click the "Add a new entry" button.
        Concept: This is my second entry.
        Definition. Do not grade, export immediately.
      12. Save changes.
      13. Log in as the teacher again and go to "My secondary glossary".
      14. Do not grade/rate. Click the "export | export to main glossary" icon for the second entry.
      15. While still on the "my secondary glossary" page, click the Maximum rating "rate" and select a number. (ex 99)
        Result: You will get a popup saying "Invalid context". Click "Ok" button and you will see the error listed in the browser Network tab.
        Adding it here on text for reference (screenshot added as well).

      {{{ }}
      {{"error":"Invalid context", }}
      {{"errorcode":"invalidcontext", }}
      {{"stacktrace":" }}
      {{* line 772 of \/mod\/glossary\/lib.php: rating_exception thrown}}
      {{* line 7749 of \/lib\/moodlelib.php: call to glossary_rating_validate() }}
      {{* line 7731 of \/lib\/moodlelib.php: call to component_callback()}}
      {{* line 994 of \/rating\/lib.php: call to plugin_callback() }}
      {{* line 1091 of \/rating\/lib.php: call to rating_manager->check_rating_is_valid() }}
      {{* line 66 of \/rating\/rate_ajax.php: call to rating_manager->add_rating() ",}}
      {{"debuginfo":" }}
      {{Error code: invalidcontext",}}





            Unassigned Unassigned
            jebarvia Joshua Ebarvia
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski
            0 Vote for this issue
            3 Start watching this issue