Question type

Question type

por yu peng -
Número de respuestas: 14

Since I upgraded Moodle, there have been issues with the code runner:  Question type always "Undefined"  : (

En respuesta a yu peng

Re: Question type

por Richard Lobb -
The most likely explanation is a bug in Moodle discussed at length here: https://github.com/trampgeek/moodle-qtype_coderunner/issues/255

The bug has now been fixed and the bug fix will appear in Moodle 5.02, scheduled for release on August 11. If you're in a hurry for a fix you can grab a weekly Moodle 5.0 release. Or, an alternative stop-gap measure which I think should work, install all the built-in prototypes in your course (from here). But you'll have to remove them all again after upgrading to Moodle 5.02 or you'll have multiple copies of all prototypes and nothing will work.

I've installed CodeRunner on several fresh installs of Moodle 5.0 and never had issues, so I think the bug primarily affects Moodles that were upgraded from an earlier version. 
En respuesta a Richard Lobb

Re: Question type

por yu peng -
Thanks. This problem has been troubling us for several months. I've installed CodeRunner on several fresh installs of Moodle 5.01,find the same problem for code runner. I have to tell you this,your job is very important for teaching, thanks again !
En respuesta a yu peng

Re: Question type

por Richard Lobb -
I'm surprised you have had trouble with CodeRunner on Moodle 5.01 with a fresh install. We do this regularly when testing. And just yesterday I fired up a brand new stock-standard Moodle 5.01 on a Digital Ocean server and installed CodeRunner with no issues.

Have you tried recently?
En respuesta a Richard Lobb

Re: Question type

por yu peng -
The  fresh installed  moodle version is 5.0+ (Build: 20250417) (I made a mistake with 5.0.1)
I did another fresh install with moodle 5.0.1+ (latest release), find the same issue: "Undefined".  CoderRunner(5.7.1+(2025052100))
And I think we need 5.0.2 (5.0、5.0.1 5.0.1+ looks like the same:20250417,if you click the bottom of the course,It's the same: 20250417 )
En respuesta a yu peng

Re: Question type

por Richard Lobb -
This doesn't sound like the problem that Moodle 5.02 will fix. Please answer the following questions relating to your freshly installed Moodle 5.0+ with CodeRunner (if possible with the site language set to English).
  1. Please send me a screen shot of where you're seeing 'Undefined', so I can be sure I'm understanding the problem.
  2. What underlying OS are you using?
  3. If you're logged in as an admin, click the Home link at the top then the Question Banks link, do you see a System Shared Question Bank?
  4. If you do see a System Shared Question Bank, click the link to it and send me a screenshot.

En respuesta a Richard Lobb

Re: Question type

por yu peng -
1.the issue

2.  The underlying OS is unubtu25.04 (server) for test.    My website : study.yali.edu.cn , the underlying OS it debian 12.11.
3.  Yes
4. Question Bank 
Anexo p2.jpg
En respuesta a yu peng

Re: Question type

por Richard Lobb -

The orange warning message on the system question banks tells us the source of the problem.

Is the Moodle CRON job set up and running? See https://docs.moodle.org/500/en/Cron


En respuesta a Richard Lobb

Re: Question type

por yu peng -

Right

Yes,It works when  cron.php executed in the fresh install. But not works in my website (update from old, executed  cron.php)

En respuesta a yu peng

Re: Question type

por Richard Lobb -

Good to hear.

The problem with your upgraded website is likely to be the moodle bug that's fixed in Moodle 5.02. However, please check:

  1. If you're logged in as an admin, click the Home link at the top then the Question Banks link, do you see a System Shared Question Bank?
  2. If you do see a System Shared Question Bank, click the link to it. Does it contain all the CodeRunner question types, with names beginning BUILTIN_PROTOTYPE... ? Please send a screenshot.

En respuesta a Richard Lobb

Re: Question type

por yu peng -
En respuesta a yu peng

Re: Question type

por Richard Lobb -
This is not what I expect at all. At the top level (courseid = 1) you should have a System shared question bank with the comment that it was created when the system was upgraded.
Screen shot of Moodle home page question bank.
You appear to have two course question banks instead. I don't understand how that happened unless you're using your home page as a course?

What's in those two course question banks (click each link in turn and paste a screenshot)?


En respuesta a Richard Lobb

Re: Question type

por yu peng -
I just don't know how to delete one. They look the same,I just cannot delete one.

Anexo p10.jpg
Anexo p9.jpg
En respuesta a yu peng

Re: Question type

por Richard Lobb -
There appears to be nothing in either of those question banks. And they're Course question banks, not System Shared question banks. 

Fankly I have no idea what's going on here. My only suggestion is that you manually increment the last digit of $plugin->version in /question/type/coderunner/version.php and let the system attempt to upgrade CodeRunner. That *should* create a system shared question bank (provided CRON is running) and add the question prototypes to it.

If (when?) that doesn't work (i.e. no system shared question bank is created), look in Site administration > Server > Tasks > Ad hoc tasks. There should be a CodeRunner task there. Did it succeed or fail? If it failed, is there are message about why?

Alternatively, maybe you should use one of your new fresh Moodle 5.0 servers and copy your courses across to that?
En respuesta a Richard Lobb

Re: Question type

por yu peng -
In fact,our school use moodle more than 20 years. We have 1100 courses ,they are more than 4T. So ,it's very hard to copy courses to the  new fresh Moodle .Thaks a lot for reply so much times. I wait for the next moodle version (maybe 5.0.2) to resolve these problem . Our last final exam use vpl for programming for this reason. But code runner has some special ,It's hard for us to abandon it.