Discovered a bug with lesson grades. While calculating the grade, intval was used to truncate the decimals from the grade. intavl is now replaced with round. round will now round the grade to 5 decimal places. The database only holds int(3). So, this has been changed to float to hold decimal numbers. We have found this to be much more accurate when converting the stored percentage in the database back to a point value (before this fix, users were getting numbers like 46.5 points instead of their original 47 points due to an inaccurate percent value). Files changed for this fix include:
locallib.php report.php version.php view.php db/mysql.php db/mysql.sql db/postgres7.php db/postgres7.sql
This commit is contained in:
@@ -211,6 +211,10 @@ function lesson_upgrade($oldversion) {
|
||||
modify_database('','CREATE INDEX prefix_lesson_grades_userid_idx ON prefix_lesson_grades (userid);');
|
||||
modify_database('','CREATE INDEX prefix_lesson_pages_lessonid_idx ON prefix_lesson_pages (lessonid);');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005060900) {
|
||||
table_column('lesson_grades', 'grade', 'grade', 'real', '', 'unsigned', '0', 'not null');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user