added rounding to 1 decimal place to sqlite answer stats queries

This commit is contained in:
BroodjeAap 2020-11-16 20:09:36 +01:00
parent bc8b08bcf4
commit ae2264c706

View file

@ -134,7 +134,7 @@ class PracticeDatabase {
correct, correct,
incorrect, incorrect,
total, total,
(correct / total) * 100 AS ratio ROUND((correct / total) * 100, 1) AS ratio
FROM FROM
AnswersCorrectByTypeViewAll AnswersCorrectByTypeViewAll
UNION ALL UNION ALL
@ -144,7 +144,7 @@ class PracticeDatabase {
correct, correct,
incorrect, incorrect,
total, total,
(correct / total) * 100 AS ratio ROUND((correct / total) * 100, 1) AS ratio
FROM FROM
AnswersCorrectByTypeView7d AnswersCorrectByTypeView7d
UNION ALL UNION ALL
@ -154,7 +154,7 @@ class PracticeDatabase {
correct, correct,
incorrect, incorrect,
total, total,
(correct / total) * 100 AS ratio ROUND((correct / total) * 100, 1) AS ratio
FROM FROM
AnswersCorrectByTypeView30d; AnswersCorrectByTypeView30d;
'''); ''');
@ -173,7 +173,7 @@ class PracticeDatabase {
["All", "30d", "7d"].forEach((range) => { ["All", "30d", "7d"].forEach((range) => {
PracticeType.values.forEach((type) { PracticeType.values.forEach((type) {
var typeRange = "$range ${type.toString().split(".").last}"; var typeRange = "$range ${type.toString().split(".").last}";
emptyStats[typeRange] = 0; emptyStats[typeRange] = 0.0;
}) })
}); });
return emptyStats; return emptyStats;