Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math delimiters fix doesn't work for Quiz categories #322

Closed
Jarvil opened this issue Nov 1, 2017 · 6 comments
Closed

Math delimiters fix doesn't work for Quiz categories #322

Jarvil opened this issue Nov 1, 2017 · 6 comments

Comments

@Jarvil
Copy link

Jarvil commented Nov 1, 2017

Hello,

We cannot fix math delimiters on a course that has STACK-questions directly in/under Quiz categorybank. If they are in courses questionbank the fix works fine.

Stack version tested with; 4.0.1 (2017082400) & 3.5.7 (2017060600) & Moodle versions 3.1

When trying to fix delimites we get an error;

Coding error detected, it must be fixed by a programmer: The course you passed to $PAGE->set_cm does not correspond to the $cm.

`[:error] [pid 31117] [client 109.70.166.98:53474] Default exception handler: Koodivirhe havaittu, ohjelmoijan pit\xc3\xa4\xc3\xa4 korjata se: The course you passed to $PAGE->set_cm does not correspond to the $cm.

Debug: \nError code: codingerror\n* line 1023 of /lib/pagelib.php: coding_exception thrown\n*

line 4033 of /lib/navigationlib.php: call to moodle_page->set_cm()\n*
line 3537 of /lib/navigationlib.php: call to settings_navigation->load_module_settings()\n*
line 724 of /lib/pagelib.php: call to settings_navigation->initialise()\n*
line 773 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()\n*
line 3145 of /lib/navigationlib.php: call to moodle_page->__get()\n*
line 3189 of /lib/navigationlib.php: call to navbar->has_items()\n*
line 55 of /theme/bootstrapbase/renderers/core_renderer.php: call to navbar->get_items()\n*
line 42 of /theme/herald/layout/columns1.php: call to theme_bootstrapbase_core_renderer->navbar()\n* line 1028 of /lib/outputrenderers.php: call to include()\n*
line 958 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()\n*
line 1831 of /lib/setuplib.php: call to core_renderer->header()\n*
line 56 of /question/type/stack/replacedollars.php: call to bootstrap_renderer->__call()\n, referer: https://xxxx/question/type/stack/replacedollarsindex.php

Images;

stack111

stack2

@Jarvil Jarvil changed the title Math delimiters fix doesn't work for Quiz categories Math delimiters fix doesn't work in Quiz categories Nov 1, 2017
@Jarvil Jarvil changed the title Math delimiters fix doesn't work in Quiz categories Math delimiters fix doesn't work for Quiz categories Nov 1, 2017
@Jarvil
Copy link
Author

Jarvil commented Nov 2, 2017

any idea @timhunt

@timhunt
Copy link
Member

timhunt commented Nov 2, 2017

Not sure.

I imagine that this fix script was based on the replacedollars.php script that I wrote ages ago. Yes, it is the same script: https://github.com/maths/moodle-qtype_stack/blob/master/replacedollars.php. My memory is that worked for quiz contexts, but this is years ago, so I would not trust my recollection.

Please can you turn up Moodle's Debugging setting to DEVELOPER level, so we get a full stack trace?

@Jarvil
Copy link
Author

Jarvil commented Nov 2, 2017

Hello,

here is the error with Developer-level debugging;

Notice: Trying to get property of non-object in /var/www/moodle/xxx/lib/navigationlib.php on line 1219

Debug info:
Error code: codingerror

Stack trace:

line 1023 of /lib/pagelib.php: coding_exception thrown
line 4033 of /lib/navigationlib.php: call to moodle_page->set_cm()
line 3537 of /lib/navigationlib.php: call to settings_navigation->load_module_settings()
line 724 of /lib/pagelib.php: call to settings_navigation->initialise()
line 773 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()
line 3145 of /lib/navigationlib.php: call to moodle_page->__get()
line 3189 of /lib/navigationlib.php: call to navbar->has_items()
line 55 of /theme/bootstrapbase/renderers/core_renderer.php: call to navbar->get_items()
line 4265 of /lib/outputrenderers.php: call to theme_bootstrapbase_core_renderer->navbar()
line 60 of /theme/clean/layout/columns1.php: call to core_renderer->full_header()
line 1028 of /lib/outputrenderers.php: call to include()
line 958 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line ? of unknownfile: call to core_renderer->header()
line 1831 of /lib/setuplib.php: call to call_user_func_array()
line 56 of /question/type/stack/replacedollars.php: call to bootstrap_renderer->__call()
line 56 of /question/type/stack/replacedollars.php: call to bootstrap_renderer->header()

@timhunt
Copy link
Member

timhunt commented Nov 2, 2017

The strange thing is that this line: https://github.com/maths/moodle-qtype_stack/blob/master/replacedollars.php#L40 should have already set the right cm indirectly.

Then, for some reason, this line: https://github.com/maths/moodle-qtype_stack/blob/master/replacedollars.php#L56 is interectly causing it to get set to something different. Will need some debugging to work out why, based on the stack trace, and I don't have time today.

@Jarvil
Copy link
Author

Jarvil commented Nov 2, 2017

Ok, thanks for the help. I will be waiting for the fix (I'm not a coder myself)

@timhunt
Copy link
Member

timhunt commented Apr 4, 2018

I finally got around to looking at this, and have done a pull request to add the same fix that was used in bulktest.php.

sangwinc added a commit that referenced this issue Apr 10, 2018
Fix replacedollars script for quiz contexts #322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants