small fixes
This commit is contained in:
parent
0e251bd01c
commit
fd8c1fc16d
|
@ -10,7 +10,7 @@ If you want an app, you can find it [here](https://github.com/dan63047/TetraStat
|
|||
# Available functionality
|
||||
- Advanced stats for players
|
||||
- Rank cutoffs and averages
|
||||
- Sqlite Database and service, that can work with it
|
||||
- Sqlite database, that can store all data
|
||||
- Comparison to players, rank averages, and player stats from the past
|
||||
- Stats Calculator
|
||||
- Player history in charts
|
||||
|
|
|
@ -81,7 +81,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
teto.open();
|
||||
initDB();
|
||||
_scrollController = ScrollController();
|
||||
_tabController = TabController(length: 6, vsync: this);
|
||||
if (widget.player != null){
|
||||
|
@ -111,6 +111,10 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
});
|
||||
}
|
||||
|
||||
void initDB() async{
|
||||
await teto.open();
|
||||
}
|
||||
|
||||
Future<List> fetch(String nickOrID, {bool fetchHistory = false}) async {
|
||||
TetrioPlayer me = await teto.fetchPlayer(nickOrID);
|
||||
_searchFor = me.userId;
|
||||
|
@ -121,6 +125,22 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
List<TetrioPlayer> states = [];
|
||||
TetraLeagueAlpha? compareWith;
|
||||
var uniqueTL = <dynamic>{};
|
||||
if (isTracking){
|
||||
await teto.storeState(me);
|
||||
await teto.saveTLMatchesFromStream(await teto.getTLStream(me.userId));
|
||||
tlMatches.addAll(await teto.getTLMatchesbyPlayerID(me.userId));
|
||||
for (var match in tlStream.records) {
|
||||
if (!tlMatches.contains(match)) tlMatches.add(match);
|
||||
}
|
||||
tlMatches.sort((a, b) {
|
||||
if(a.timestamp.isBefore(b.timestamp)) return 1;
|
||||
if(a.timestamp.isAtSameMomentAs(b.timestamp)) return 0;
|
||||
if(a.timestamp.isAfter(b.timestamp)) return -1;
|
||||
return 0;
|
||||
});
|
||||
} else{
|
||||
tlMatches = tlStream.records;
|
||||
}
|
||||
if(fetchHistory) await teto.fetchAndsaveTLHistory(_searchFor);
|
||||
states.addAll(await teto.getPlayer(me.userId));
|
||||
for (var element in states) {
|
||||
|
@ -151,22 +171,6 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
DropdownMenuItem(value: [for (var tl in uniqueTL) if (tl.estTr != null) FlSpot(tl.timestamp.millisecondsSinceEpoch.toDouble(), tl.estTr!.esttr)], child: Text(t.statCellNum.estOfTR.replaceAll(RegExp(r'\n'), " "))),
|
||||
DropdownMenuItem(value: [for (var tl in uniqueTL) if (tl.esttracc != null) FlSpot(tl.timestamp.millisecondsSinceEpoch.toDouble(), tl.esttracc!)], child: Text(t.statCellNum.accOfEst.replaceAll(RegExp(r'\n'), " "))),
|
||||
];
|
||||
if (isTracking){
|
||||
await teto.storeState(me);
|
||||
await teto.saveTLMatchesFromStream(await teto.getTLStream(me.userId));
|
||||
tlMatches.addAll(await teto.getTLMatchesbyPlayerID(me.userId));
|
||||
for (var match in tlStream.records) {
|
||||
if (!tlMatches.contains(match)) tlMatches.add(match);
|
||||
}
|
||||
tlMatches.sort((a, b) {
|
||||
if(a.timestamp.isBefore(b.timestamp)) return 1;
|
||||
if(a.timestamp.isAtSameMomentAs(b.timestamp)) return 0;
|
||||
if(a.timestamp.isAfter(b.timestamp)) return -1;
|
||||
return 0;
|
||||
});
|
||||
} else{
|
||||
tlMatches = tlStream.records;
|
||||
}
|
||||
Map<String, dynamic> records = await teto.fetchRecords(me.userId);
|
||||
return [me, records, states, tlMatches, compareWith, isTracking];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ name: tetra_stats
|
|||
description: Track your and other player stats in TETR.IO
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.0.0+5
|
||||
version: 1.0.1+6
|
||||
|
||||
environment:
|
||||
sdk: '>=2.19.6 <3.0.0'
|
||||
|
|
Loading…
Reference in New Issue