Skip to content

Commit

Permalink
[overview] 3回目以降の不正解問題のみの学習が更新されない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreNion committed Apr 19, 2023
1 parent da7e52e commit 69bc84f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/pages/subject/section/overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ class _SectionPageState extends State<SectionPage> {
// 正解記録を適切な場所に保存する
record.forEach((id, correct) async {
await updateQuestionRecord(id, correct);
final len = miQuestions.indexWhere((mi) => mi.id.compareTo(id) == 0);

setState(() {
_latestCorrects[
miQuestions.indexWhere((mi) => mi.id.compareTo(id) == 0)] = correct;
_latestCorrects[len] = correct;
});
});
setState(() => loading = false);
Expand Down Expand Up @@ -156,8 +156,17 @@ class _SectionPageState extends State<SectionPage> {
// 不正解のみの場合、不正解の問題のみ送る
final sendQs = onlyIncorrect
? miQuestions
.where((mi) =>
!(mi.latestCorrect ?? false))
.asMap()
.entries
.map(
(entry) {
if (!(_latestCorrects[entry.key] ??
false)) {
return entry.value;
}
},
)
.whereType<MiQuestion>()
.toList()
: miQuestions;
if (sendQs.isEmpty) {
Expand Down

0 comments on commit 69bc84f

Please sign in to comment.