Formula Type Question - Ignore blank answer boxes in grading criteria

Formula Type Question - Ignore blank answer boxes in grading criteria

by Daniel Milan -
Number of replies: 28

First post, so I hope that I get this somewhat right:

I am hoping that someone can assist me in an issue I am having with grading the parts of a multi-step question.  I have attached the xlm. file.

Please know that I have zero (0) coding and scripting experience and this is all trial and error for me.  

There are 6 parts to the question I have attached, but I was mainly working in "part 1" and "part 2" in an attempt to get it working.  I will use "part 1" as the reference for my discussion.

Issue: each answer box must contain a number in order to be validated as an answer.
ex.  There are three student answer required for "part 1": _0, _1 and _2, each weighted 33.3% of that parts marks.
Entering 3 correct answers (one in each box) returns 100% of the grade for that part.
Entering 2 correct answers and 1 wrong answer will return 66.67%, and
Entering 1 correct and 2 wrong will return 33.3%

The error occurs if any one box is not filled.  So if the student enters the first two answers correctly and forgets, misses, cannot solve the last of the three and leaves it blank, the question returns 0% for that parts marks, regardless of the other correct entries;  I would like this example to return a grade of 66.67%

This is the scripts that I was using in part 1 of the question: (variable assignment can be found in the xlm file)

***GRADING VARIABLE SECTION***
#ERROR CALCULATIONS
absoluteError0=abs(R75-_0); 
relativeError0=absoluteError0/R75; 

absoluteError1=abs(XL75-_1); 
relativeError1=absoluteError1/XL75; 

absoluteError2=abs(Z-_2); 
relativeError2=absoluteError2/Z; 

# GRADING CRITERION
criterion0=relativeError0<=0.02; 
criterion1=relativeError1<=0.02;
criterion2=relativeError2<=0.02;

***GRADING CRITERIA SECTION***
(1/3)*criterion0+(1/3)*criterion1+(1/3)*criterion2


I'm sure that there must be a way to tell the grading criteria to assign a mark of 0 for each box left blank, but like I said, I have no coding experience.

Any help in adding in lines to ignore empty answer boxes and assign blank answers a score of zero (0) would be greatly appreciated.

Thank you.

Average of ratings: -
In reply to Daniel Milan

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Daniel,

You do not need to use a Grading criterion if there is no particular relationship between the answers. Although your solution is divided into five steps, you do not have to use five parts. Instead, you can define 14 different parts in the Formulas question. Use Part 1 for R75, Part 2 for XL75, Part 3 for Z, Part 4 for VR, Part 5 for 0, Part 6 for VXL, etc. You can arrange these 14 parts in exactly the same five steps as what you have now. Each part will be treated individually and will have no effect on the other parts if it is left blank.

In reply to Dominique Bauer

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Daniel Milan -

Hi Dominique,

Thank you for your reply. The initial creation of that question was designed exactly as you have stated. The issue that I was having with breaking it into parts is that parts would not align side-by-side yet only appear one after another in a vertical alignment. This resulted in confusion as to which box was to be designated for what. Being that these are vector Solutions with both magnitude and angle it was more clear to have them side-by-side and that's why the question was rewritten.

Perhaps I was doing something wrong that would not allow them to align horizontally as I had written them in the original question text.


xlm file attached as well.

The vertically alignment is extremely undesirable.  

Thank you again



In reply to Daniel Milan

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Daniel,

You just need to add the HTML tag <div style="display:inline-block;"></div> to prevent the input boxes from going to the next line:

<p>Record the answer for:</p>
{A} + {B} =
<div style="display:inline-block;">{#1}</div>
and {B} + {C} =
<div style="display:inline-block;">{#2}</div>

In the Parts' text, make sure that the HTML is just {_0} without tag, that is, not <p>{_0}</p>.

See https://moodleformulas.org/course/view.php?id=22&section=63.

See also https://moodle.org/mod/forum/discuss.php?d=368429#p1486230.

Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Daniel Milan -

BRILLIANT!!

Thank you so very much.  That is definitely something that I was not aware of.  That will most certainly resolve my issue.

Now to re-write a re-written question.

In reply to Dominique Bauer

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Thanks Dominique for answering this question.

This is very important : each part of the formulas questions has only one answer and this answer can have one or more "coordinates" (When Hon Wai Lau first released this question type it's name was "coordinates" and he changed the name to "formulas" some months or years latter) and (optionally) an unit.

Coordinates don't need to have any relationship between them, but all coordinates need to receive an answer for the part to be considered as gradable. If one coordinate is missing the part will be considered as "not answered" or "incomplete" I don't remember exactly.

So If you want to allow the student to only input some answers you need to define several parts.

For the fact that parts can't be displayed inline, even if I hate to modify the way questions are displayed I am inclined to think we should consider this as a bug and fix it.

If I remember well with the Hon Wai Lau version this  problem was not present.

I welcome comments on this problem.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

I just checked and changing

.que.formulas .formulation .formulaspart {
    display: block;
    margin: 0 0 1.2em 0;
    padding-bottom: 0;
}
To

.que.formulas .formulation .formulaspart {
    display: inline;
    margin: 0 0 1.2em 0;
    padding-bottom: 0;
}

in the question/type/formulas/styles.css stylesheet is enough to permit parts to be displayed inline but there is still the problem of the Atto editor putting <br> and paragraph tags around what you write, so you are forced to switch to html display and remove them.

What do you think of changing the stylesheet ? Would it cause any inconvenience to some users ?

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Jean-Michel,

I think changing the style sheet is a good idea and it probably would not cause a lot of inconvenience, if any.

It seems to me that display: inline-block works better than display: inline so that the height of the answer boxes is taken into account with the rest of the text, especially if it extends over more than one line.

In reply to Dominique Bauer

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Dominique,

Yes inline-block is a better idea. I always forgot about these blocks acting as inline smile

I have committed to my Github a new version including that change (in fact 2 new versions : one for Moodle 2.6 to 2.9 and one for Moodle 3.0 to 3.4 but with exactly the same change). Once the Travis jobs tell me that all is fine I will upload these versions to the Moodle plugin Directory.

There is a bump in the version number to allow the style change to take effect.

Note: this version also includes a small fix to a bug that was never reported: if you select "Show the number of correct responses once the question has finished" it was displayed as "You have correctly selected xx." that is not very appropriated for Formulas questions, it now display "You have correctly answered xx part(s) of this question."

I only spotted that problem a few days ago, and even if it wasn't reported better to fix it.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Hello Jean-Michel, 

I have  tested your new Github version and it works fine for placeholders, but I think that it may destroy  the layout  of other text. 

See attach, this  text initially  was 3 different lines,  each one for each part.

Attachment Screen Shot 2018-05-09 at 22.00.52.png
In reply to Bernat Martinez

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Bernat,

Can you send me the xml file of this question and a picture of how it was displayed in previous version ?

I hope this change doesn't affect too many Formulas questions !

The master branch in my Github account now have the combined feedback for parts and the privacy provider for GDPR alias RGPD (will only work with Moodle versions soon to be released) it would be super if you can test that too.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Hello Jean-Michel, 

I think you could test by yourself the questions at (could use teacher/teacher or your own account)

https://formulas.compasspro.eu/mod/quiz/view.php?id=223

There are two using place holders, one of them displays it correctly as uses Dominique' advice. The other without placeholder is scattered in parts. 

At the moment Moodle is using the standard css, if you agree and tell me I could install your new css in order you see the difference. Please let me know. 

Later we could test the new version with combined feedback for parts and GDPR, may be is better to go step by step.


In reply to Bernat Martinez

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Bernat,

I have downloaded the questions from the units question bank category.

Yes I understand the problem. When a part has no placeholder it's text is just added at the end of the question text and that create a mess if the question creator was expecting each part to be on a different line.

I can confess I remember very well that many years ago when I discovered that Hon Wai Lau had allowed parts without placeholder and also that answer boxes not found in the part's text are appended at the end of the part I was quite horrified and that if I had created the Formulas question type I would never have done that.

Then I made some backup/restore tests and discovered that Formulas questions could be broken in the process ( a little difficult to explain but the code was relying on the part's record id in the database to reorder parts without placeholders and of course most often that id  changes during the backup/restore process and order is not always preserved if the code is not done in the correct way and unfortunately that was the case).

At that moment I think the right decision would have been to enforce the use of placeholders for all parts (and for instance put a default value like #1, #2 when the part is created) and to include all answer boxes in each part's text. But I wanted to maintain compatibility with existing Formulas question so I choose to modify the code to ensure that the order of the question's parts will remain unchanged during backup/restore.

Now it's too late and we must live with all the questions without placeholders and incomplete answer boxes list in part's texts.

So what can be done ? I need some time to try to find the best solution that would allow inline parts and not break existing questions.

As you are running a course to explain how to create formulas questions can you tell the participants that my advice is to always use placeholders and to include all answers boxes in part's text ? I can be wrong but I think that this is what I did in all the questions that I created for my students.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

reading again my previous message I think I was unclear : missing part placeholders is a major problem, missing answers placeholders is a very minor problem and has not caused any problem until now.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Thanks Jean-Michel for the clear explanation. 

In fact I have started to use place folders just recently, now I'm informing teachers that in a composed answer if using placeholders every part is graded separately, and if not, student can get only all the points or zero.

Another point which has arisen in the course is about part feedback. Now it is only shown when is incorrect or partially correct. Someone have argued that it could be shown also for correct answers as it could show an alternative way of presenting the answer. For example is the answer as an equivalent fraction.

Please let me know when you would like to test the new developments

In reply to Bernat Martinez

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

For part feedback, the real solution is the part combined feedback that is about to be released. In fact I am just waiting that Moodle release the new 3.3.6, 3.4.3 and 3.5 so that people can use the new privacy api to release new GDPR compliant versions of all my question types and question import/export formats (excluding of course those that are now maintained by other people like ddmatch and multichoiceset).

As this release is ready in the master branch of my Github, feel free to test it if you want, or if you prefer wait next week to install it from the Moodle plugin Directory.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Hello Jean Michel

I have installed it from your Github,  the combined feedback is shown as it seen in the attach

Unfortunately I have had problems to login afterwards as it showed a blank page

 It seems that when writing  https://formulas.compasspro.eu it added automatically admin/login.php 

Does it makes any sense to you?

Now I have reverted to old version as there are participants working at the course

Attachment Screen Shot 2018-05-11 at 15.30.06.png
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Jean-Michel,

Let me quote a passage from "Some features we use in FORMULAS questions" on Bernat's Practice Course (https://formulas.compasspro.eu/course/view.php?id=14#section-1):

What this means is that even for a very simple question, you have to edit the HTML code.

Adding:

<div style="display:inline-block;">{#1}</div>

should not be more complicated than adding:

<div>style="border-bottom: 2px solid black;">{#1}</div>
<div>style="padding-top: 4px;">{#2}</div>

In addition, it seems that changing the stylesheet could be more difficult than it initially seemed.

Therefore, imho, this development may not be worth pursuing.

In reply to Dominique Bauer

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Bernat,

I think that I understand what happened when you tested the new version: as this version define new database fields (to store the part combined feedback) and new language strings, you need to go to Administration and update your database, but it seems that you haven't done that and that explain all the problems with the lang strings on the edit page and when the code is trying to store the result of the question edit page and also the fact that you are directed to Administration after that. If my guess is wrong and you have done the upgrade but it failed, please report it because that would mean that I should make more tests before release.

But at the same time I don't know if upgrading on a live site is a good idea as if you do that you will not be able to go back as you have done if something go wrong (even if I have made a lot of tests including creating question with images or variables in the part combined feedback and doing backup and restore, each change invole the probability of introducing bugs).

If you decide to test the new version and upgrade, I strongly advise to make a complete backup of all the website files and database before that (as always of course but better to say it one more time).

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello,

I have done 2 quick tests

- Install a Moodle fresh site, install the previous version of Formulas and upgrade to the future version

- install a Moodle fresh site and install the future version

Everything seems to work as expected

I had already done these tests but with the git branch where I was developing the new features so I was worried that I did something wrong when I merged these changes on my master branch, so better to test with the master branch. Apparently there is no problem.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

In addition, it seems that changing the stylesheet could be more difficult than it initially seemed.

Therefore, imho, this development may not be worth pursuing.

Hello Dominique, Yes I think it would be wise that I revert this change before releasing the next version because it may break a lot of existing Formulas questions.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Jean-Michel, 

You are right, I have now your version at the course,and  it is working fine. 

But as supposed it is breaking some questions. 

As this is a just a course for learning I will try to use the "problem" as a learning event, When you release the last version I will update it.

Attachment Screen Shot 2018-05-14 at 13.26.44.png
In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Matthias Giger -
Picture of Particularly helpful Moodlers

I changed the stylesheet back in my instance because it broke a lot of questions.

In reply to Matthias Giger

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Matthias,

This is my fault. I forgot to remove that change before releasing version 4.6. It was planned but I forgot about it.

Today I released version 4.61 that correct this problem.

Sorry for the inconvenience.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Bernat Martinez -

Hello Jean-Michel, 

I have installed 4.6 version, it shows as before but now when creating a MultipleChoice it puts the text and the MC in different paragraphs. In older versions was in the same.

I have tried to compare both  css files and couldn't find where is the cause of this. 




Attachment Screen Shot 2018-05-21 at 18.25.11.png
In reply to Bernat Martinez

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Hello Bernat,

That is strange I am quite sure that I have made no change related to multichoice questions for months. Maybe we cans study the source of the page and try to understand the problem.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

Can you send me your question in xml form ? My questions with multichoice parts display as usual. I see no change.

EDIT: Stupid me! I forgot to go to Administration, so I wasn't really using the last styles.css.

I see the problem now but I don't understand why it was working before wide eyes

This line in the code seems in fact completely wrong to me (but to my surprise it has been like that for years !)

https://github.com/jmvedrine/moodle-qtype_formulas/blob/master/renderer.php#L274

Why did I use the formulaspart style for the select menu ? This is dumb!

I will create a proper formulas_menu style and apply it.

Later we will see if we also need another style for multichoice with radios buttons or not.

In reply to Jean-Michel Védrine

Re: Formula Type Question - Ignore blank answer boxes in grading criteria

by Jean-Michel Védrine -

The fix is now in my github in the master branch

the commit is here: https://github.com/jmvedrine/moodle-qtype_formulas/commit/9a29d5c5b060aded656f6bfe643d3ecb9a6ddc1f

If you can test it it would be good.