GithubHelp home page GithubHelp logo

trampgeek / moodle-qtype_coderunner Goto Github PK

View Code? Open in Web Editor NEW
205.0 205.0 118.0 74.08 MB

CodeRunner: A moodle quiz question type that runs student-submitted program code in a sandbox to check if it satisfies a given set of tests.

License: GNU General Public License v2.0

PHP 5.37% Python 0.24% JavaScript 93.34% CSS 0.07% Gherkin 0.91% Mustache 0.07%

moodle-qtype_coderunner's People

Contributors

abautu avatar ak4t0sh avatar anahue avatar anupamasarjoshi avatar comqdhb avatar czuhajster avatar danghieu1407 avatar emilyprice avatar eric-ide avatar eviweb avatar fastsandslash avatar imarichev avatar jeremycadams avatar jimbonothing64 avatar liuyu81 avatar lszeremeta avatar lucaboesch avatar markusgafner avatar marxjohnson avatar mckeownp avatar mctoohey avatar mkassaei avatar mrud avatar rmallah avatar sammarshallou avatar sangwinc avatar thehickman avatar timhunt avatar trampgeek avatar wtrnoguchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-qtype_coderunner's Issues

question types

Hello

I need python3_cosc121 this type how can i upload in coderunner

Placeholders using in SQL queries

Hello,

First of all I want say thank you for your work with the plugin.

We found some code fragments which should be changed to comply Moodle code requirements:
https://docs.moodle.org/dev/Data_manipulation_API#Placeholders

  • in question/type/coderunner/classes/bulk_tester.php in category_path() method the variable $catid is concatenated directly to SQL query. It should be passed as one of the parameters to $DB->get_record_sql() instead.

Best regards,
Olena Tatarintseva

Hard-wired English language strings

Hi,
After translating in AMOS most of the English language strings for this plugin, I found that the user sees some untranslated English language strings in the 'Question type details' section, that belong to the text that describe the builtin PROTOTYPES.

You can easily check this using the mexican Spanish language pack.

For example, in coderunner\db\builtin_PROTOTYPES.xml
Line 795: A generic Python3 question. For each test case, the

If it is not terribly complicated, I think this plugin would be even better if these hard-wired English language strings could be made into string variables, so that they would be available in AMOS for translation into other languages different from English. Most of the strings from this plugin have already been translated into German, Romanian and Mexican Spanish :)

Thanks in advance for your help.

Occasional "plugin failure" messages

I'm running version 3.4.0 on a Moodle 3.4.2 install. We're using the REMUI ui. Our docker container was built ~2 weeks ago, so I believe this has all the 3.4.0 commits.

Occasionally, when students access a coderunner question, they get a message that I believe is

amd/src/userinterfacewrapper.js:                alert("Failed to load UI component. If this error persists, please report it to the forum on coderunner.org.nz");

I haven't been able to reproduce this error -- I have experienced it, but can't reliably reproduce it.
Happy to help diagnose.

runguard not called. No debug info/logs available

Hi Richard,

I'm trying to set up moodle + coderunner at home to give my kids some extra python practice. I'm using the runguard sandbox, but the runguard executable looks like it is never getting called. I've installed everything successfully, and selected runguard as the sandbox to use. Permissions all look ok. Clicking the "Check" button at the bottom of a quiz question results (after a second or two) in the exact same page. I changed the name of the runguard executable, and the "Click" button had the same no-op effect. There must be some errors happening somewhere but I can't seem to find out if they are logged, and if so, where to look. There's nothing useful in /var/log/apache2/

Using Jupyter kernels for code execution?

Although most commonly known as an interactive notebook serving environment, the Jupyter ecosystem may be more usefully thought of as a set of protocols that, among other things, support remote code execution in dynamically launched "kernels" which are now available for a wide variety of programming languages.

Jupyter servers such as the Jupyter kernel gateway or the Jupyter enterprise gateway provide headless access to individually launched remote kernels.

One of the issues with using different code environments for teaching (eg using Jupyter notebooks) and assessment (eg using CodeRunner) is the need to maintain consistency across code environments if students are expected to create assessed code fragments that run the same way in the test server as their own Jupyter powered coding environments.

Which got me wondering: how well defined is the API to the sandbox environment which CodeRunner executes code in and is the sandbox server (Jobe?) expected to run as service? (Indeed, can it be run as a remote service?)

If the coupling is handled via a well defined API, then could a middleware shim be used to provide sandboxed code execution either via remotely launched Jupyter kernels or via the current sandboxed environment server?

This would allow Jupyter users to make use of the same code environments for running coding labs using Jupyter UIs as well as CodeRunner based assessments, as well as extending the range of code environments supported by CodeRunner.

(As an aside, Jupyter has several candidate autograding solutions, such as nbgrader as well as integration with okpy, but nothing that I am aware of that is integrated with Moodle explicitly.)

New grading scheme (remove all whitespaces, newlines) and compare result

While having demonstrators entering the expected output or first year students trying to match the output often times trailing whitespaces, double whitespaces in the question, uppercase/lowercase etc. are an issue.

How about providing a new grading scheme named messy/fuzzy/simple or something like that that would remove all spaces (incl. newlines) from both result and expected and will do an case insensitive match?

Feature Request: pre-defined student input.

Hi,

we would like to be able to set a pre-defined input for a CodeRunner question which then has to be completed by the student, i.e. something like that

def sort(input_list):
    # your code goes here

def main():
    input_list = read_list()
    print(sort(input_list))

I was unable to find a way to do this. Are there any interest in this functionality? I'd take a shot at it, if you are ready to merge it.

Thank you

although this is not an issues, it is a thank you. Thank you for the work that you have done on this, this will be a valuable asset to the development of software programming throughout New Zealand as we move from a local test to more of a nationwide test.

What version of moodle is it capable with?

jobe with https

My jobe server is running and working behind a https, but in moodle when I try to run a sample quiz (python3) gives errors:

https://xxxx.xxxx.xxx.xx/jobe/index.php/restapi/languages returns:
[["c","7.5.0"],["cpp","7.5.0"],["java","11.0.7"],["nodejs","8.10.0"],["pascal","3.0.4"],["php","7.2.24"],["python2","2.7.17"],["python3","3.6.9"]] and all is working,

in Moodle gives a error saying that sandbox is not running or there was an error processing the python question.

Moodle 3.9 version.

Feature Request: Command Line Arguments

Hello,

I'm a Data Structures instructor, currently using CodeRunner for running student C++ code. Recently in an attempt to utilize CLAs (e.g. ./someProgram foo.txt 12) with the cpp_program option, I was unable to find support for this feature.

Is this something that there would be an interest in? Or is there a reason it hasn't been implemented before?

I would say, if there is such an interest, we actually have a guy here on campus who's quite familiar with the CodeRunner codebase and is also interested in helping us implement it. The plan so far would be something simple like adding an additional input box/field to the current setup as a CLA input field. We would just probably need a pointer (no pun intended) to where in the codebase something like this would live.

Thanks!

Problem upgrading from 3.7.5 to 3.7.9

I can't upgrade coderuner from version 3.7.5(2020012500) to 3.7.9(2020080300) or any version higher for that matter. When I try to update the database, I get the following error:

Coding error detected, it must be fixed by a programmer: You can only set identifiers on initial definition creation. Define a new cache to set different identifiers.

More information about this error
Debug info:
Error code: codingerror
Stack trace:

    line 792 of /cache/classes/definition.php: coding_exception thrown
    line 255 of /cache/disabledlib.php: call to cache_definition->set_identifiers()
    line 182 of /cache/classes/loaders.php: call to cache_factory_disabled->create_cache_from_definition()
    line 461 of /question/engine/bank.php: call to cache::make()
    line 468 of /question/engine/bank.php: call to question_finder->get_data_cache()
    line 245 of /question/engine/bank.php: call to question_finder->uncache_question()
    line 651 of /question/type/coderunner/questiontype.php: call to question_bank::notify_question_edited()
    line 278 of /question/type/coderunner/questiontype.php: call to qtype_coderunner->notify_prototype_children_if_any()
    line 458 of /question/format.php: call to qtype_coderunner->save_question_options()
    line 195 of /question/type/coderunner/db/upgradelib.php: call to qformat_default->importprocess()
    line 158 of /question/type/coderunner/db/upgradelib.php: call to load_questions()
    line 50 of /question/type/coderunner/db/upgradelib.php: call to load_new_prototypes()
    line 342 of /question/type/coderunner/db/upgrade.php: call to update_question_types()
    line 692 of /lib/upgradelib.php: call to xmldb_qtype_coderunner_upgrade()
    line 1917 of /lib/upgradelib.php: call to upgrade_plugins()
    line 713 of /admin/index.php: call to upgrade_noncore()

Here is a screenshot:

upgrading_database_after_coderunner_update

Minor issue with % in penaltyregime

Judging by the validation code, a penaltyregime like 2%, 4%, ... should work fine.

However, on our server, for a question like that, we get a PHP notice like:

Notice: A non well formed numeric value encountered in /srv/moodle.open.ac.uk/www/html/question/behaviour/adaptive_adapted_for_coderunner/behaviour.php on line 191

I don't think this is a serious problem, but I thought I would report it.

This may be something that changes in a recent PHP version. We are on PHP 7.3.16.

Too many params passed to js_call_amd

I have coderunner 2018042800 on ubuntu server 18.04 with moodle version 2018071300.00.
The supporting plugin is adaptive_adapted_for_coderunner version 2018042800.

I have no other plugins installed.

I have all developer debug messages sent to the screen and when I create a coderunner question, I get the following message:

line 1026 of /lib/outputrequirementslib.php: call to debugging()
line 77 of /question/type/coderunner/edit_coderunner_form.php: call to page_requirements_manager->js_call_amd()
line 204 of /lib/formslib.php: call to qtype_coderunner_edit_form->definition()
line 113 of /question/type/edit_question_form.php: call to moodleform->__construct()
line 217 of /question/type/questiontypebase.php: call to question_edit_form->__construct()
line 201 of /question/question.php: call to question_type->create_editing_form()

Then, when I save the question type, I get the following error:

Too many params passed to js_call_amd("qtype_coderunner/authorform", "initEditForm")
line 1026 of /lib/outputrequirementslib.php: call to debugging()
line 77 of /question/type/coderunner/edit_coderunner_form.php: call to page_requirements_manager->js_call_amd()
line 204 of /lib/formslib.php: call to qtype_coderunner_edit_form->definition()
line 113 of /question/type/edit_question_form.php: call to moodleform->__construct()
line 217 of /question/type/questiontypebase.php: call to question_edit_form->__construct()
line 201 of /question/question.php: call to question_type->create_editing_form()

I am using a development version of Moodle, but I got a similar message with a current version of Moodle 3.5.

Thanks.

Supporting older data format of coderunner database

As you can see, Coderunner is a project with fast-evolving features and formats. It is increasingly being used by many institutes, which often run long courses that can span for more than a year. Also, I've talked to a lot of sysadmins, and they don't have the opportunity to update the servers (often once a year, or less), and their attitude tend to be "don't touch it unless you have to". Therefore by the time they update the server, a lot of formats have already changed in coderunner, and things become broken.

Therefore in my opinion, we can't assume that course only have a short lifetime, and remove support of legacy formats at will during refactoring. We need to at least be able to read the old data, with or without converting them to the new format.

To achieve this goal, I propose to set up a directory called "legacyclasses" where we can put classes represent old format such as legacytestingoutcome.php, to enable database created by older versions of coderunners to be able to be read.

Another example is the question type fields in pre-coderunner 2.4, which you have stripped after coderunner 3.0. At the moment, sysadmins will need to set up a separate VM with coderunner pre 3.0 to read in the course and re-export to a new format course. Again, the class that allows reading in the old question type need to be reinstated, and go to the "legacyclasses" directory.

tmp folder location should not assume /tmp

There are a couple of places in code calling tempnam() with /tmp as the path, this should be replaced with moodle's make_request_directory() which creates and returns a folder inside $CFG->localcachedir that is automatically removed once the php execution has finished.

Many Moodle Partners do not condone plugins writing to /tmp, and we specifically size our servers to have restricted /tmp with relatively small partition sizes compared to the configured $CFG->localcachedir path for moodle to use.

At the very least, you should use $CFG->tempdir if you feel make_request_directory() is not adequate.

Upgrade Twig

Do you plan to upgrade Twig to the latest version?

Java alternate main method not recognised

In Java, the main method is defined (per Java language specification document) as:

`public static void main(String[] args)` 

However, Java does not care about the order of the public and static modifiers. The following code is also valid:

`static public void main(String[] args)`

This is confirmed in the specification - the relevant bit is If two or more (distinct) method modifiers appear in a method declaration, it is customary, though *not required*, that they appear in the order consistent with that shown above in the production for MethodModifier. (emphasis mine).

The javac compiler compiles both the first and the second variant. CodeRunner however can run the first, but not the second. Instead, a syntax error is reported (at least when using java_program type):
prog.java:1: error: class X is public, should be declared in a file named X.java, where X is any valid class name.

I believe this is due to the "hardcoded" main method here.

EDIT: on further inspection, the source of this problem is this function.

request documentation for adding new language support

Can you please add documentation of how to add new language support? If I want to add a new question type which requires students to write code in language XYZ, how can I do it, and what assumptions does code runner make about the language?

When I look at the code architecture the architecture doc there is something referred to as the "Executable program" which is the output of the Twig template engine. However, "executable program" is not really defined. Is this assumed to be a single ascii file? Or is this allowed to be a directory structure containing arbitrarily many files in arbitrarily many subdirectories?

We need more descriptive messages for custom grader errors

I am using a template grader. When the sandbox times out, Coderunner spits out this very non-descriptive error message:

Bad output from grader: (nothing). Please report this error to your tutor.

from this line in qtype_coderunner.php:
$string['brokencombinatorgrader'] = 'Bad output from grader: {$a->output}. Please report this error to your tutor.';

Is it possible to give a more meaningful message that can distinguish from other errors such as out of memory?

CodeRunner makes inappropriate use of global $USER

In start_attempt, CodeRunner intends to store the user id of the user who's quiz attempt this is in a variable _STUDENT.

And, it assumes that global $USER will be set to the user who is attempting the quiz. This is not a safe assumption, and we just hit it in a plugin we were making: (https://github.com/moodleou/moodle-quiz_answersheets. Specifically see the hack we had to add in https://github.com/moodleou/moodle-quiz_answersheets/blob/master/classes/external.php.)

I don't really have a suggestion for how this feature can be made to work properly. I know this was something that was asked for, but the Moodle question system intentionally does not link question_attempt or question_usage to a userid, because when I was implemening the question system, I was aware of feature requests like group quiz attempts (https://tracker.moodle.org/browse/MDL-48699). The only reliable link from a question_attempt in a quiz, to userid is via question_attempt -> question_usage -> quiz_attempt, and of course that is quiz-specific, so also something you should refer to in a question type. And anyway, that would change if group quiz attempts were implemented.

JSON error on custom template grader for octave

SOLUTION IN DOCUMENTATION ONLY: ISSUE MAY BE DELETED

Error in question

Exception: Bad JSON output from combinator grader output. Output was: {"comment":"All good!"}

In the above I am just disp'ing the following: {"comment":"All good!"}
What is the expected format for the grader output?
In octave how will it be achieved?

I don't find any documentation nor any pointer to where the default templates are stored in the code.
Thanks.

Maybe, a little documentation can help a much.

Version problem upgrading Moodle from 3.2.x to 3.3.x

Code Runner 2018103000 appears to be available for 3.2.x and 3.4.x but only version 2018071000 is available for 3.3.x - This means that the Moodle upgrade disables the plug-in and refuses to 'upgrade' it as it considers it a downgrade.

Tighten security around the LANGUAGE_CACHE_FILE cache

because this file lives in tmp, it is theorietically possisble that another user on the Jobe server could tamper with it. Therefore, when we load it, it would be a good idea to verify the contents before they are used.

I am about to do a patch for this.

Fix snip method

The snip method of qtype_coderunner_util class in util.php, that cuts the middle of the string, messes up UTF-8 encodings, so moodle throws exception after trying to save attempt data to question_attempt_step_data table.
In my case it happens with big test case data in russian with utf8mb4 encodings on both moodle and mysql sides.
There is a FIXME comment near snip method about this problem, so I can assume, that you are awared of it already. But I don't found any Issues.
I was forced to comment out snip method call in tidy mehod to give users the ability to keep working with this questions, so now it lookes like this:

      public static function tidy($s) {
        if ($s === null) {
            return null;
        } else {
            return $cleaneds = self::clean($s);
            //return self::snip($cleaneds);
        }
    }

Is there any updates about this problem?

Integrating moss

First of all let me say thanks for CodeRunner. We will use this module for our undergrad c programming course and I think it will be very helpful.

I am just wondering, from an architectural point of view, what would be the best way to integrate moss with CodeRunner? I don't know much about moodle internals but somehow it seems like existing code plagarism tools require file uploads :/

Plugin for having own/custom sandbox server

For the course I am running I wrote a plugin based on the ideone, to submit code to a local sandbox server which compiles and executes the code. The idea here is that we want to use department moodle server without and don't send the code from the students to another entity.

The benefit of having a own version instead of ideone is:

  • Ability to specify runtime parameters like in the runguard sandbox
  • Support file uploads
  • Faster turn around times

I am not sure if you would be interested in it (the server is currently rather simple and supports only two languages) but I would think having a somehow easy solution to run your own sandbox server is really nice.

I put up the current version in the paste but I would need to clean it up first.

General architecture

  • /code to upload the code, with additional, optional parameters for sandbox parameters, file upload etc.
  • /<link>/status status, returning same data as ideone
  • /link/details details like compiler info etc.
  • /languages supported languages

I didn't use the SOAP interface as I had problems creating a proxy and just used a simply flask program instead.

The server side is currently really WIP and I started to adapt your class design etc. but it is rather a hack...

If you think there could be interest/it is merge-able after cleanup, I may be able to clean things a little bit up and provide a pull request. The problem is for the time being this solution is based on the needs for our installation, so I am not sure if other people would benefit from it.

Remove all unnecessary features/files

Hi there,

Coderunner has a lot of additional features (autotag, delete categories, download attempts, ...) that actually should not belong to a question type. This makes it harder to review the code and leads to a larger attack surface.

Please remove all these features and files that are not vital for the question type. If you need some of the features, please create another Moodle plugin (e.g. as a quiz report) or try to get the features into Moodle core.

After a very short review I have found some problems:

  1. These additional scripts do not check the sesskey (CSRF vulnerability).
  2. deletecategorytree.php: It checks the contextid but it does not check whether the category belongs to this context. A user who is allowed to manage at least one category is able to delete any category.
  3. prototypeusageindex.php: It displays all courses in the system to everyone, even hidden courses.

Thanks.

Can we have Twig_Extension_StringLoader please?

If we have the Twig_Extension_StringLoader loaded in the CodeRunner environment, it unlocks the template_from_string function and allows for some powerful additional use cases without drastically altering coderunner source code or impacting its performance.
For example, this could allow the testcase.testCode, tescase.expectedOutput etc. to themselves include twig code. Either this could be done by merely adding the extension to the environment and then creating suitable question templates that utilise template grading, or it should be possible via further PHP changes to allow the expectedOutcome to include twig code as standard, without having to customize or change the standard templates at all.
An example use case here would be creating questions or template questions with a number of variations based on question parameters or random values. For example, the question author could ask a student to create a function in Python or Java that outputs an ASCII art square n stars in size, where the number of stars requested from the student is controlled by a question parameter. Having access to twigCode in the testCase code and expected output fields would make this much easier than the current model, which would require a heavily customised question.
I think this is a lightweight alternative way of achieving some of the changes David Bowes has proposed in his fork of CodeRunner.

This plugin does not implement the Moodle privacy API

This plugin does not implement the Moodle privacy API. If this plugin stores any personal data it will not be able to be exported or deleted through Moodle's privacy system.

It would be nice if you can fix this.

Thanks in advance.

GDPR compliance?

Can you add a section to the readme to what extent your extension complies with the GDPR? Is there anything to consider?

Make time limit a float instead of an int?

Any reason that the "TimeLimit (secs)" setting (under Advanced Customization) couldn't be a floating point number (e.g. 0.5 seconds), instead of being restricted to an integer (as it currently is)?

Add Tags for Release Versions

Would it be possible to tag the release versions of this repo in git? This makes it much simpler to clone a specific version of the repo and eases the burden of downstream release management, especially for those of us building Moodle installs via scripts (e.g. for Docker).

E.g.
Running:

git tag 2016071501 4761d636cd6ac86daeab1a3736657c0995f87376
git push --tags

Allows one to replace:

git clone --recursive --single-branch \
"https://github.com/trampgeek/moodle-qtype_coderunner.git" \
"${MOODLE_CODE_PATH}/question/type/coderunner" \
&& cd "${MOODLE_CODE_PATH}/question/type/coderunner" \
&& git checkout 4761d636cd6ac86daeab1a3736657c0995f87376 \
&& cd

With the cleaner:

git clone --recursive --single-branch -b 2016071501 \
"https://github.com/trampgeek/moodle-qtype_coderunner.git" \
"${MOODLE_CODE_PATH}/question/type/coderunner"

I'd file this as a pull quest, but github does not currently allow importing git metadata such as tags via pull request -- tags can only be applied by someone with commit access to the repo itself.

Please add more languages for Moodle server at http://coderunner.org.nz/

Hi Richard,
Thanks for fixing the reCAPTCHA problem. I have successfully registered and I hope I can now learn a bit more about your plugin.

According to Tim Hunt's post at https://moodle.org/mod/forum/discuss.php?d=241098#p1046621 , "Language packs have almost 0 impact on Moodle performance."

So, I think it might be a good idea for you to install some more languages in your Moodle server at http://coderunner.org.nz/. Many of the strings from this plugin have already been translated into German, Romanian and Mexican Spanish.

This would allow people like me (a Moodle translator) to check how well the Mexican Spanish translation of your plugin works in a properly configured server that hosts many CodeRunner question types. And it would also allow me to take some screen dumps, in order to illustrate the recently created Moodle Docs in Spanish page for this plugin at https://docs.moodle.org/all/es/Tipo_de_pregunta_CodeRunner :)

I hope you don't mind that I have copied much of your plugin documentation into a Moodle Docs page at https://docs.moodle.org/34/en/CodeRunner_question_type . This page can now be easily translated into languages other than English, and help many more Moodlers world-wide. This Moodle Docs page is also linked when a teacher presses the 'Moodle Docs for this page' at the bottom of a page when the teacher is creating/editing a CodeRunner question type. Please feel free to add/remove/change as much as you think is needed.

I have now completed 100% translation in AMOS of your CodeRunner plugin and I hope to have a Mexican Spanish language pack with 100% translated strings for all core and 'Early Bird 3.5' plugins by the time of the 3.5 Official release date :)

Coderunner Exception after installation

I just installed coderunner on a fresh installed moodle server and get the following Exceptions.
Exception - Class 'qtype_coderunner\constants' not found and Exception - Class 'qtype_coderunner_sandbox' not found. What can i do to resolve this?

Comments to line code

Hello, I have a question: can I make comments in coderunner in any specific line of the student's code? As if I were commenting on a document from Microsoft Word or Google Docs? I have been reading the documentation I think it does not currently support it, but can someone please tell me how I could get this feature? Thank you

Regrading with coderunner questions

Hello,

Thank you for providing such a valuable tool with Moodle. Our CS department uses is quite frequently and we find it very useful.

One thing I noticed is regrading larger sized quizzes (many student submissions) takes a very long time to process. I reviewed some of the logs trying to determine why it's slow and it appears grading requests go to the jobe sandbox sequentially to be processed. I only see one REST request at a time when watching the web server logs hosting jobe sandbox. Upon further troubleshooting, I also noticed this behavior also happens when you try and submit two questions to be graded simultaneously (e.g. two chrome windows open with a coderunner preview). The last one submitted will wait for the other to finish processing, but if you repeat the above using a different browser (chrome + firefox), the two submissions will process in parallel.

My suspicion is this is due to session keys and contention/blocking issues. This may be associated with moodle base classes and not the coder runner implementation, but I wanted to inquire if you have seen this behavior, and if so, if you know of any settings or workarounds so that regarding can happen in parallel.

Thanks for any suggestions you might have!
-Tim

DB error in question_get_top_category: found more than one record!

Hello @trampgeek

I've found another bug/issue. After installing the CodeRunner qtype it add's following row to the <prefix>_question_categories table:

id: 226943
name: CR_PROTOTYPES
contextid: 1
info: Category for CodeRunner question built-in prototypes. FOR SYSTEM USE ONLY.
infoformat: 0
stamp:
parent: 0
sortorder: 999

The problem here is, that the contextid should not be 1? Only the top and default system category have this context defined. For what is this CR_PROTOTYPES?

Debugging message:

Error: mdb->get_record() found more than one record!
line 1583 of /lib/dml/moodle_database.php: call to debugging()
line 1543 of /lib/dml/moodle_database.php: call to moodle_database-&gt;get_record_sql()
line 1522 of /lib/dml/moodle_database.php: call to moodle_database-&gt;get_record_select()
line 1263 of /lib/questionlib.php: call to moodle_database->get_record()
line 1317 of /lib/questionlib.php: call to question_get_top_category()
line 487 of /question/editlib.php: call to question_make_default_categories()
line 328 of /question/editlib.php: call to question_build_edit_resources()
line 31 of /question/edit.php: call to question_edit_setup()

Thanks for your help
Adrian

Change Ace code editor theme

Dear authors,

Thank you for your great plugin!
I am wondering how to change the code editor's theme for CodeRunner. I found that function load_ace_if_required() called js_call_amd('qtype_coderunner/aceinterface', 'initAce', array($textareaid, $lang)) so that I changed the file amd/source/aceinterface.js by adding theme: 'ace/theme/twilight' after line 91 in it but nothing happened.
Can you show me how I can do to get it done?

Best regards,
Phong

quiz featuring a custom grader question precheck/check goes to custom HTML that immediately reverts back to original question page

In a quiz that has a custom grader question, when the user clicks "pre-check" or "check" in that custom grader question, the browser navigates to the custom HTML with the images and the custom result table, but after a fraction of seconds, the browser goes back to the original question page, leaving the user with no chance to see the check outcome.

To reproduce this bug:

  • install Lubuntu 16.04 in a VM
  • install moodle 3.2.2, or 3.1.4
  • pull git moodle-qtype_coderunner into moodle/question/type/coderunner
  • pull git moodle-qbehaviour_adaptive_adapted_for_coderunner into moodle/question/behaviour/adaptive_adapted_for_coderunner
  • navigate to localhost/moodle in firefox in the VM
  • create a course
  • import the attached question that has a custom grader
  • create a quiz
  • add the imported question into the quiz
  • attempt the quiz
  • type in answer as instructed in the question
  • click "precheck" or "check"

question.zip

Twig expansion in General Feedback

Hi,

I'm writing Python3 questions using Coderunner, and was using a template parameter to hold the name of a function. I have a few similar questions, and so I wanted to be able to just change a function name once in the parameters rather than everywhere. I have the 'Hoist template parametersandTwig all` options turned on, and the function name is successfully expanded in the question text, the answer and the tests, but isn't expanded in the general feedback. It just prints {{ fnname }} in the general feedback text. I presume I don't need to be doing any escaping, as it successfully expands everywhere else, so this is presumably just a bug?

Thanks,

Sam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.