only show 100 most recent uses in level bar popup (#1224)

This commit is contained in:
ggurdin 2024-12-12 11:00:38 -05:00 committed by GitHub
parent 029dbef481
commit 43040c4010
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -4622,5 +4622,6 @@
"currentXP": {},
"maxXP": {}
}
}
},
"registrationEmailMessage": "Please verify your email with a link sent there. In some cases, the email takes up to 5 minutes to arrive. Please also check your spam folder."
}

View file

@ -22,7 +22,7 @@ class ConstructListModel {
_uses.clear();
}
final List<OneConstructUse> _uses = [];
List<OneConstructUse> _uses = [];
List<OneConstructUse> get uses => _uses;
/// A map of lemmas to ConstructUses, each of which contains a lemma
@ -70,8 +70,9 @@ class ConstructListModel {
}
void _updateUsesList(List<OneConstructUse> newUses) {
newUses.sort((a, b) => a.timeStamp.compareTo(b.timeStamp));
_uses.addAll(newUses);
newUses.sort((a, b) => b.timeStamp.compareTo(a.timeStamp));
_uses.insertAll(0, newUses);
_uses = _uses.take(100).toList();
}
/// A map of lemmas to ConstructUses, each of which contains a lemma

View file

@ -111,7 +111,7 @@ class LevelBarPopup extends StatelessWidget {
child: ListView.builder(
itemCount: uses.length,
itemBuilder: (context, index) {
final use = uses[(uses.length - 1) - index];
final use = uses[index];
String lemmaCopy = use.lemma;
if (use.constructType == ConstructTypeEnum.morph) {
lemmaCopy = getGrammarCopy(