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

Coding error detected, it must be fixed by a programmer: Inconsistent placeholders. Possibly due to multi-lang filtter not being active. #939

Closed
lhueber opened this issue Apr 4, 2023 · 8 comments

Comments

@lhueber
Copy link

lhueber commented Apr 4, 2023

Some of my questions just broke with the warning: "Coding error detected, it must be fixed by a programmer: Inconsistent placeholders. Possibly due to multi-lang filtter not being active." I can save it fine, but it wont generate variants anymore.

I wasn't using another language but weirder to me is that the questions worked fine a few hours ago. They are BIG but since I'm not quite ready yet for being responsible for variant-sharing across questions, I had to bang a whole Z-test into one question.
There could be coding errors, but I played around with it loads a few hours and go and it was generating test variants quite happily.

Here is the code for what it's worth. I've played around with decreasing the randomisation, but no luck. Played around with the drop down menues (ta1/2), nothing changed.

nr: rand(100)+50000;
min_weight: 55 + rand(4);
sig_lev: rand([0.01,0.05,0.1]);
samp_mean: min_weight-(2+rand(20))*0.1;
std_dev: rand(9)*0.1+4;
samp_size: rand(10)+60;
std_err: std_dev / sqrt(samp_size);
p_value: cdf_normal(samp_mean,min_weight,std_err);

tal1: [[a,false],[b,true],[c,false],[d,false]];
ta1:b;
tal1b: [[a,false],[b,false],[c,true],[d,false]];
ta1b:c;

ta2: sig_lev;
ta3: samp_mean;
ta4: std_dev;
ta5: samp_size;
ta6: dispdp(std_err,5)
ta7: dispdp(p_value,5);

if sig_lev > p_value then (ss:1) else (ss:2);
tal8:["reject", "not reject"];
ta8: tal8[ss];
tal9:["yes","no"];
ta9: tal9[ss];

@sangwinc
Copy link
Member

sangwinc commented Apr 4, 2023

Sorry you're having problems. This error is generated here:
https://github.com/maths/moodle-qtype_stack/blob/master/renderer.php#L80

Given you say the question is big, you might have exceeded the practical system limits. You won't be the first person to write truly huge questions which can't be evaluated, but I think the problem is more likely to be authoring problems with your tags.

I'm 99% confident this error is caused by a question authoring problem. This forum is really for bugs in the software itself, so until we can identify a clear bug in the STACK code (not your use of STACK) I'm proposing to close this issue.

Chris

@sangwinc sangwinc closed this as completed Apr 4, 2023
@lhueber
Copy link
Author

lhueber commented Apr 4, 2023

Hmm, @sangwinc usually I would totally agree with anyone who said that there's a mistake in the code as I'm not an accomplished coder by any means. But in this case, something else might seems to be going on. Might still be very much my mistake, but it's not the code in the question. I imported it onto the demo server and it's fine there. In short, on my live server, it is not rendering, but on the demo server it is.
I tried it on my other STACK site on the live server, and it renders fine there as well. I've re-imported it into the first live STACK site, and it doesn't render. Is there some how that I could have broken the rendering mechanism?

@lhueber
Copy link
Author

lhueber commented Apr 4, 2023

Now even more of my questions, simple rounding questions, have stopped working. Heeeelp!!
I can't attach the files here, but the mistake cannot be in the coding in the question itself.
But there are differences in the way the system communicates the problem to me. When I try to enter a quiz:
image
When I try to preview or create variants:
image

@aharjula
Copy link
Member

aharjula commented Apr 5, 2023

Well... Yelling help helps no one without some context. Did anything happen during the hours when things stopped working? Did someone update your Moodle, your STACK or something else related to them? And you really need to specify what, if anything, you are doing with languages when the error message is pointing towards multi-lang. Is that filter active or not (maybe someone turned it off), and are there language things present in the question? Were those things present before things broke and now missing due to some editing errors? Were these questions authored in the system where they do not work, does that system have the same version of STACK etc... Did you move the questions between courses or other contexts that might have different filter settings?

Do note that the "code" you posted is worthless here, as it is in no way related to the error. That error comes from the text content and happens typically when one has multiple copies of the same placeholder present due to duplicates not being eliminated through conditional rendering or language variant elimination when duplicates are seen it is indeed a coding error or maybe someone messed up the filters doing that elimination. Are there multiple copies of [[input:X]], [[validation:X]], or [[feedback:X]] with the same value of X in that question text, if there are are those correctly wrapped in

To figure anything out the whole question with all the bits is necessary, and if you can upload those questions into that "ed.ac.uk" Moodle, then Chris can probably see those questions, but you need to help people helping you by at least giving links to the questions and giving some context.

If STACK has not been updated, you did not edit the questions between the time they worked and stopped working, and there are languages in play, I would bet on someone messing up with the Moodle filters. That or some editing mistakes with a tidying editor that has broken the multi-lang tags, or maybe some tidying filter above multi-lang...

@lhueber
Copy link
Author

lhueber commented Apr 5, 2023

Sorry for the yelling. I'm not a programmer, somewhere between a user and a noob. When my questions stop working in the middle of a course for no apparent reason, I cry. I was trying to figure out how to share the code/question more effectively, but couldn't see how.
I'll contact our STACK wizards at the university. I can not see the site administration myself.

@aharjula
Copy link
Member

aharjula commented Apr 5, 2023

Do note that filter settings are tunable at course/context level, so if you are able to create quizzes, you should also be able to tune filters. Although not their order which is one of the things that a site admin can mess up.

But first, try to talk to your local systems people as questions do not simply fail without the system changing and it seems odd that anyone would update systems "in the middle of a course". Did something change, with version updates, filter settings, or Maxima installations? Also did someone transfer those questions around as files and if so does that person know how to work with those files and not open and save them with random tools?

@aharjula
Copy link
Member

aharjula commented Apr 5, 2023

Ok. So assuming that this is the same issue we have just diagnosed, this was indeed a filter issue but not an issue related to languages in any way. Those filters managed to change the placeholders, and STACK became quite confused when it saw that the set of placeholders after filtering was inconsistent with what was just detected before it.

For those that may see that error in their own operations, this is what happened this time:

  1. The context in which this question was used had the Moodle filter called "Activity names auto-linking" active, this filter checks content for names matching activities and as its name says, it turns those bits into links to those activities.
  2. An activity was added, and it was called "Feedback".
  3. After that, we no longer saw the expected [[feedback:prt1]] placeholder in the content, as the word "feedback" had been turned into a link which looks somewhat different to our search logic. And that is when all things broke down. The moment that activity was created, everything changed as there was a name that matched things relevant to logic.

Now, how to deal with this:

  1. Just turn that filter off everywhere and disable it so that no one can turn it on.
  2. If you cannot turn it off everywhere, turn it on only where it is needed and never where it can cause damage.
  3. If it is needed in more places than not, then just remember to turn it off for all quizzes with STACK.

Naturally, we will try to find a way to become immune to this effect, but it may be quite difficult as we do like to support filters in general and targeting this or any others is not that easy.

@lhueber
Copy link
Author

lhueber commented Apr 5, 2023

That was it! I just checked and it works now. Indeed, I added the activity called "feedback" and I know the links you mention.

Thank you sooooo much to you @aharjula and @sangwinc. Sorry for shouting again :)

sangwinc added a commit that referenced this issue Apr 6, 2023
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