Working percentage correct stats coming from the sqlite database, now to display them (and test the whole thing...)
This commit is contained in:
parent
65846043df
commit
e3faf41b83
1 changed files with 11 additions and 7 deletions
|
@ -135,7 +135,7 @@ class PracticeDatabase {
|
||||||
correct,
|
correct,
|
||||||
incorrect,
|
incorrect,
|
||||||
total,
|
total,
|
||||||
correct / total AS ratio
|
(correct / total) * 100 AS ratio
|
||||||
FROM
|
FROM
|
||||||
AnswersCorrectByTypeViewAll
|
AnswersCorrectByTypeViewAll
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@ -145,7 +145,7 @@ class PracticeDatabase {
|
||||||
correct,
|
correct,
|
||||||
incorrect,
|
incorrect,
|
||||||
total,
|
total,
|
||||||
correct / total AS ratio
|
(correct / total) * 100 AS ratio
|
||||||
FROM
|
FROM
|
||||||
AnswersCorrectByTypeView7d
|
AnswersCorrectByTypeView7d
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@ -155,21 +155,25 @@ class PracticeDatabase {
|
||||||
correct,
|
correct,
|
||||||
incorrect,
|
incorrect,
|
||||||
total,
|
total,
|
||||||
correct / total AS ratio
|
(correct / total) * 100 AS ratio
|
||||||
FROM
|
FROM
|
||||||
AnswersCorrectByTypeView30d;
|
AnswersCorrectByTypeView30d;
|
||||||
''');
|
''');
|
||||||
print(answers);
|
print(answers);
|
||||||
var stats = getEmtpyStats();
|
var stats = getEmtpyStats();
|
||||||
|
for(var stat in answers){
|
||||||
|
var typeRange = "${stat['range']} ${stat['type']}";
|
||||||
|
stats[typeRange] = (stat['ratio'] as double).roundToDouble();
|
||||||
|
}
|
||||||
print(stats);
|
print(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, int> getEmtpyStats(){
|
static Map<String, double> getEmtpyStats(){
|
||||||
Map<String, int> emptyStats = Map<String, int>();
|
Map<String, double> emptyStats = Map<String, double>();
|
||||||
["All", "30d", "7d"].forEach((range) => {
|
["All", "30d", "7d"].forEach((range) => {
|
||||||
PracticeType.values.forEach((type) {
|
PracticeType.values.forEach((type) {
|
||||||
emptyStats["$range ${type.toString().split(".").last}"] = 0;
|
var typeRange = "$range ${type.toString().split(".").last}";
|
||||||
|
emptyStats[typeRange] = 0;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return emptyStats;
|
return emptyStats;
|
||||||
|
|
Loading…
Add table
Reference in a new issue