Algebra and Formula qtypes

Re: Algebra and Formula qtypes

by Jean-Michel Védrine -
Number of replies: 0

I will try to explain how it should work:

The placeholder inside a part should never change, it will always stay as you have typed it, and so the placehoder is tied to the answer (or answers of the part if the part has several answer boxes associated)

But the order of the part can change because as Bernat says when the question  is saved after editing parts will be reordered to be in the same order that they appear in the question text. This simplify the code a lot when displaying the question text.

And also the part's order can change when questions are included in a backup and latter restored. 

But only the order of the parts when you edit the question can change. The place where the parts appear in the question should never change and should always stay the same.

I know the situation is not perfect but it was the only solution to a real problem : the formulas parts can use placeholders or not (very very bad idea in my opinion) and if a part don't have a placeholder it will appear at the end of the question text. 

How to ensure that parts without a placeholder will always appear in the same order at the end of the question ? 

The original code of the formulas for Moodle 1.9 was buggy and order of the parts whithout a placeholder could be completely destroyed by a backup/restore or in other circumstances. I modified the code introducing a number (partindex) created when a part is first saved (and never displayed to the user) to know how to place parts without a placeholder.

According to my tests this way parts will always appear at the same place in the question text. So I was thinking that the question can never be broken even after export/import or backup/restore.

So it worry me that you say that your questions are broken

But I am quite sure that the placeholder in the part is never changed, it can't happen. I will review my code but I am quite sure of that. 

I tried to look at the example provided but the fact that I know nothing about accounting and also that English is not my native language is preventing me from understanding if there is a bug or not.

Can you provide step by step instructions (very detailed if possible) to see the problem.