andrewhancox / moodle-filter_translations

8 stars 8 forks source link

Quiz Question preview from question bank: Error writing to database: ERROR: value too long for type character varying(32) #79

Open jgramp opened 2 years ago

jgramp commented 2 years ago

Quiz Question preview from question bank: Error writing to database: ERROR: value too long for type character varying(32)

The span tag is making the choices for 'select missing words' questions too long.

image

image

andrewhancox commented 2 years ago

I'm not clear on how the translation span got injected. It's not a rich editor so it wasn't the atto plugin, looking at the db schema there is not a 'nameformat' column to match the 'name' column so the CLI tool would not have put them in...

If you let me know the question type I will take a quick look and see what is going on.

jgramp commented 2 years ago

Spans have somehow been inserted into the input answer fields (not Atto fields) for:

andrewhancox commented 2 years ago

Did you run the CLI tool to automatically add them to existing content?

Sent from my iPhone

On 29 Apr 2022, at 00:00, Jessica Gramp @.***> wrote:

 Spans have somehow been inserted into the input answer fields (not Atto fields) for:

Numerical question Short answer question missing words question — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were assigned.

jprovasnik commented 6 months ago

Hi - this is still causing issues on my 4.3 site - users cannot attempt exams because of span tags being inserted into non-atto fields in the following question types: Calculated shortanswer, Calculated multichoice, Short Answer, Select missing word. When I edit the questions and remove the spans, all is fine, until the spans get reintroduced with the scheduled task "Insert translation spans tags \filter_translations\task\insert_spans" runs again.

Any thoughts on how to define pages in which not to insert these span tags? i do have various php pages added to the plugin's "Pages to leave untranslated filter_translations | untranslatedpages" setting, but I guess that doesnt prevent the spans from being inserted on those pages too?

Student-view of Error

student view of attempt quiz error

Calculated Multichoice

calculated multichoice spans

Calculated shortanswer

calculated spans

Select missing word:

select missing word spans

Short answer:

short answer spans
rjnl commented 6 months ago

You likely have the question "answer" field in the filter_translations | columndefinition JSON setting. The insert spans scheduled task will add the translation span tags to all the fields defined in this setting. You will need to remove the answer field and any other field that should not have the span tags from the filter_translations | columndefinition setting. (Note: all the scheduled tasks for this plugin refer to the columndefinition setting.)

See this note regarding enabling scheduled tasks for this plugin.

To get your quizzes to work again, you will have to manually edit and remove these translation span tags.

Hope this helps.

jprovasnik commented 6 months ago

Yes!! This does - I had the JSON entry below and didn't realize this was for the "Short Answer" question type.

"question_answers": [ 
    "answer" 
    "feedback" 
], 

I'll go through my other entries to see which database tables/titles I've previously included in the columndefinition list that also don't have clear titles. Once I remove a few more I'll be all set.