Can template grader differentiate active quiz vs regrading?

Can template grader differentiate active quiz vs regrading?

von Mike McDowell -
Anzahl Antworten: 2

Lately I've been experimenting with the template grader for my classes. I have a prototype that will send the first failed test result, along with the code and question text, all to AI alongside a built in prompt. This returns some text for the student where it's instructed to ask "guiding questions" to assist them.

This all works great so far. I have a 5 second timeout to the AI call built in, etc. The trouble I'm running into is, if I regrade a class question it will prompt the AI for every student on the regrade. This adds a lot of time to regrading, especially if there's a couple questions involved for a full class.


My question being, is there any way you can think of where I can have the template grader "detect" or know if this is a regrade? Maybe can it tell if there is an active user session? Any other thoughts to how I could work around this regrade time extension?

Als Antwort auf Mike McDowell

Re: Can template grader differentiate active quiz vs regrading?

von Richard Lobb -

I don't know of a way to check for a regrade, but I think I have an arguably better solution for you, anyway.

Just this week I pushed a new feature to the development branch. There's now a Twig QUIZ variable that has attributes 'name' and 'tags'. So for example if you add a tag 'useai' to a quiz, your template could then do things like

{% if 'usei' in QUIZ.tags %}
do_ai_grading()
{% endif %}

or, in pure Python:

if 'useai' in {{ QUIZ.tags | json_encode }}:
    do_ai_grading()

In your use case you might instead use a tag 'isregrade', which you could add before initiating the regrade. Does this sound like a workable strategy?

To use this feature, though, you'd have to pull the development branch from GitHub. Do you have admin rights on your server?

It should be pretty solid, but if using an institution-wide server you might not wish to. We haven't run the latest development branch on our own departmental production server yet, though we're about to.

This sounds like a fun project, Mike. Please do keep us posted.

Als Antwort auf Richard Lobb

Re: Can template grader differentiate active quiz vs regrading?

von Mike McDowell -
Interesting, sounds like I should be able to make that work. That sounds like it would be helpful for a number of different customizations.

Yes I host the Moodle instance for myself and a couple other teachers so have root access to it. I'll have a look here in the next few days and will see how it works. Thanks for the idea!