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

comma in passing grade #126

Open
lassnj opened this issue Oct 28, 2024 · 16 comments
Open

comma in passing grade #126

lassnj opened this issue Oct 28, 2024 · 16 comments

Comments

@lassnj
Copy link

lassnj commented Oct 28, 2024

When I enter a passing grade after setting up the activity, the system uses the decimal separator of the set standard language (in my case German where the decimal separator is the comma). Upon saving the activity, I get an error:

Data truncated for column 'gradepass' at row 1
UPDATE mdl_grade_items SET timecreated = ?,timemodified = ?,hidden = ?,courseid = ?,categoryid = ?,itemname = ?,itemtype = ?,itemmodule = ?,iteminstance = ?,itemnumber = ?,iteminfo = ?,idnumber = ?,calculation = ?,gradetype = ?,grademax = ?,grademin = ?,scaleid = ?,outcomeid = ?,gradepass = ?,multfactor = ?,plusfactor = ?,aggregationcoef = ?,aggregationcoef2 = ?,sortorder = ?,display = ?,decimals = ?,locked = ?,locktime = ?,needsupdate = ?,weightoverride = ? WHERE id=?
-- line 1753 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
-- line 254 of /lib/grade/grade_object.php: call to mysqli_native_moodle_database->update_record()
-- line 329 of /lib/grade/grade_item.php: call to grade_object->update()
-- line 294 of /course/modlib.php: call to grade_item->update()
-- line 717 of /course/modlib.php: call to edit_module_post_actions()
-- line 183 of /course/modedit.php: call to update_moduleinfo()

when I set the decimal separator in the passing grade field to a dot, the settings are saved without error. The passing grade needs to be updated every time a setting changes, because the system uses the decimal separator of the selected system language.

@drachels
Copy link
Owner

Truthfully, I do not remember ever testing with a decimal point in the grade to pass setting. When this occurs, what is the, Maximum grade that you are setting for the activity? Being retired and without any real student data, I tend to always just use a Maximum grade of 100 points, and just now noticed that whatever is in the Grade to pass setting is shown with two decimal places set. I know those two decimal places are controlled via what I have set in the course grade setup.

@lassnj
Copy link
Author

lassnj commented Oct 28, 2024

I'm setting an integer, but it is automatically converted to two decimal points eg. 97 is converted to 97,00. I'm also using maximum grade of 100 points, but I want to fill in the passing grade to get the green and red coloring in the grade book.

@drachels
Copy link
Owner

drachels commented Oct 28, 2024

Thanks for the prompt reply. I will warn you that for two years, I have been having severe dry-eye problems that really limit the amount of time I can stand to look at a computer monitor, so testing for this might take me some time, especially since I have other things I need to work on. Plus, yesterday, I accidentally did something that caused me to have to delete all my keyboard drivers for MooTyper. I am still in the process of doing all the driver installs, but at least, they will be in a little easier to navigate order.

It will also take me a little while to setup a Moodle that uses German and commas for the decimal settings.

@lassnj
Copy link
Author

lassnj commented Oct 28, 2024

Thanks for looking into this!

@drachels
Copy link
Owner

I just set up a totally fresh Moodle 4.5 with MooTyper 4.3.0, and right out of the box when I set my language preference to German, the setting for, Grade to pass, worked correctly with a comma. I have completed exercises as admin, teacher, and as student, without any problems. When looking at all grades or own grades, the commas are there for all the decimal places in the reports. This was on a Raspberry Pi5 with both the OS and Moodle updated to the latest versions.

I have also tested on my normal development server Running Rocky 9 Linux, and when I change my language preference to German the commas work. I have tested on my demo site on the same server and commas work on it, also.

You are welcome to visit, https://drachels.org/moodledemo/course/view.php?id=1374, you can log in as teacher1 or teacher3, using Test54321! as the password. You can also log in as any student from, student1, ..., student18, with password of Test12345! Add and set up a MooTyper activity yourself.

If you want to, send me copies of your own lessons and I will add them to the course for testing.

@lassnj
Copy link
Author

lassnj commented Oct 30, 2024

Hi,
thanks for providing the demo installation. The problem exists, if you switch your Moodle language to German:
grafik
Then set a "Bestehensgrenze" in the settings:
grafik
You can also Switch to German and open https://drachels.org/moodledemo/course/modedit.php?update=8449&return=1
Then hit Save (Speichern).
grafik

Stack trace: 

    line 500 of /lib/dml/moodle_database.php: dml_write_exception thrown
    line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
    line 1686 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
    line 1719 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
    line 254 of /lib/grade/grade_object.php: call to mysqli_native_moodle_database->update_record()
    line 329 of /lib/grade/grade_item.php: call to grade_object->update()
    line 294 of /course/modlib.php: call to grade_item->update()
    line 721 of /course/modlib.php: call to edit_module_post_actions()
    line 183 of /course/modedit.php: call to update_moduleinfo()

Thank you for working on this.
Kind regards!

@drachels
Copy link
Owner

drachels commented Oct 30, 2024

I am stumped at the moment. Yesterday, it worked like you would expect it to, but today, I am able to duplicate the problem. I will do some more testing and let you know if I figure anything out.

@lassnj
Copy link
Author

lassnj commented Oct 30, 2024

creating the activity is not the problem, it still works then, but changing the settings later on produces the error.

@drachels
Copy link
Owner

To me, what is really weird is that I am looking at the MooTyper code and comparing to forum code and they are the same.

@drachels
Copy link
Owner

I think there might be a temporary work around. In both places where you can enter, Bestehensgrenze, for the Whole MooTyper, or Rating, enter only a whole number such as 97 or 70. Do not put it in as 97,00 or 70,00. The activity will then save and can be used as expected.

@drachels
Copy link
Owner

I am sorry that due to health problems it has taken me so long to verify and test what the cause of this problem is. Had to install a new server to test it. The locale in your server has not been set up to include the locale, de_DE, de_DE@euro, or de_DE.utf8.
You can check by opening a terminal window for your server and type, locale -a.
The list needs to include the last one, de_DE.utf8.
If it is not there type, sudo dpkg-reconfigure locales
In the list that pops up, you can add any in the list that you might want to use. For MooTyper development, I use the first option of, All.

@lassnj
Copy link
Author

lassnj commented Nov 13, 2024

Hi,
thanks for looking into this, we will check the server locale.
Regards

@lassnj
Copy link
Author

lassnj commented Nov 15, 2024

Hi @drachels,
the server locale was not the problem. We have all the german locales installed.

The forum activity has this additional code, that converts the comma if necessary:
https://github.com/moodle/moodle/blob/269a8a8a1b3965e95e713ccc93ad1b7eb0d0e249/mod/forum/mod_form.php#L505C13-L509C93

Could you add that in your plugin?
Thanks a lot!
Regards

@drachels
Copy link
Owner

I will see about adding this fix, but it will take me a few days as I am in the middle of some other work on Diary and iContent. I also just 30 minutes ago received an equipment shipment I needed to complete setting up a new work station, which I will need to do later today.

By any chance, if you go to Site administration > Language > Language packs, and click on, Update all installed language packs, do you see any errors reported?

The reason I ask, is that the only times I have been able to duplicate this problem is when I was getting an error about locales when I was getting a language pack update or install error.

@drachels
Copy link
Owner

While doing some server upgrades this morning, I took a few moments to make this change in the MooTyper code at the demo course link you used above:
I will push this to my master branch here at github, as soon as possible.

@lassnj
Copy link
Author

lassnj commented Nov 19, 2024

By any chance, if you go to Site administration > Language > Language packs, and click on, Update all installed language packs, do you see any errors reported?

we have special rights management, so yes, but the error is by design in our configuration.

thanks for applying the fix!!

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

2 participants