You can see old TL matches again

This commit is contained in:
dan63047 2024-07-28 20:38:14 +03:00
parent 6adecbe64d
commit 90ad788c6c
3 changed files with 25 additions and 16 deletions

View File

@ -896,8 +896,8 @@ class TetraLeagueBetaStream{
for (var entry in json) records.add(BetaRecord.fromJson(entry)); for (var entry in json) records.add(BetaRecord.fromJson(entry));
} }
addFromAlphaStream(TetraLeagueAlphaStream oldStream){ addFromAlphaStream(List<TetraLeagueAlphaRecord> r){
for (var entry in oldStream.records) { for (var entry in r) {
records.add( records.add(
BetaRecord( BetaRecord(
id: entry.ownId, id: entry.ownId,

View File

@ -236,10 +236,10 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
_TLHistoryWasFetched = true; _TLHistoryWasFetched = true;
} }
} }
if (storedRecords.isNotEmpty) _TLHistoryWasFetched = true; if (storedRecords.isNotEmpty) {
_TLHistoryWasFetched = true;
// add stored match to list only if it missing from retrived ones tlStream.addFromAlphaStream(storedRecords);
if (oldMatches != null) tlStream.addFromAlphaStream(oldMatches); }
// tlMatches.sort((a, b) { // Newest matches gonna be shown at the top of the list // tlMatches.sort((a, b) { // Newest matches gonna be shown at the top of the list
// if(a.ts.isBefore(b.ts)) return 1; // if(a.ts.isBefore(b.ts)) return 1;

View File

@ -112,10 +112,11 @@ class TlMatchResultState extends State<TlMatchResultView> {
bool bigScreen = width >= 768; bool bigScreen = width >= 768;
if (roundSelector.isNegative){ if (roundSelector.isNegative){
time = totalTime; time = totalTime;
readableTime = "${t.matchLength}: ${time.inMinutes}:${secs.format(time.inMicroseconds /1000000 % 60)}"; readableTime = !time.isNegative ? "${t.matchLength}: ${time.inMinutes}:${secs.format(time.inMicroseconds /1000000 % 60)}" : "${t.matchLength}: ---";
}else{ }else{
time = roundLengths[roundSelector]; time = roundLengths[roundSelector];
readableTime = "${t.roundLength}: ${time.inMinutes}:${secs.format(time.inMicroseconds /1000000 % 60)}\n${t.winner}: ${widget.record.results.rounds[roundSelector].firstWhere((element) => element.alive)}"; int alive = widget.record.results.rounds[roundSelector].indexWhere((element) => element.alive);
readableTime = "${t.roundLength}: ${!time.isNegative ? "${time.inMinutes}:${secs.format(time.inMicroseconds /1000000 % 60)}" : "---"}\n${t.winner}: ${alive == -1 ? "idk" : widget.record.results.rounds[roundSelector][alive].username}";
} }
return SizedBox( return SizedBox(
width: width, width: width,
@ -448,10 +449,14 @@ class TlMatchResultState extends State<TlMatchResultView> {
children: [ children: [
Text(t.matchLength), Text(t.matchLength),
RichText( RichText(
text: TextSpan( text: !totalTime.isNegative ? TextSpan(
text: "${totalTime.inMinutes}:${NumberFormat("00", LocaleSettings.currentLocale.languageCode).format(totalTime.inSeconds%60)}", text: "${totalTime.inMinutes}:${NumberFormat("00", LocaleSettings.currentLocale.languageCode).format(totalTime.inSeconds%60)}",
style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, fontWeight: FontWeight.w500, color: Colors.white), style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, fontWeight: FontWeight.w500, color: Colors.white),
children: [TextSpan(text: ".${NumberFormat("000", LocaleSettings.currentLocale.languageCode).format(totalTime.inMilliseconds%1000)}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))] children: [TextSpan(text: ".${NumberFormat("000", LocaleSettings.currentLocale.languageCode).format(totalTime.inMilliseconds%1000)}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))]
) : const TextSpan(
text: "-:--",
style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, fontWeight: FontWeight.w500, color: Colors.grey),
children: [TextSpan(text: ".---", style: TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))]
), ),
) )
],), ],),
@ -507,10 +512,14 @@ class TlMatchResultState extends State<TlMatchResultView> {
), ),
child: ListTile( child: ListTile(
leading:RichText( leading:RichText(
text: TextSpan( text: !time.isNegative ? TextSpan(
text: "${time.inMinutes}:${NumberFormat("00", LocaleSettings.currentLocale.languageCode).format(time.inSeconds%60)}", text: "${time.inMinutes}:${NumberFormat("00", LocaleSettings.currentLocale.languageCode).format(time.inSeconds%60)}",
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 22, fontWeight: FontWeight.w500, color: Colors.white), style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 22, fontWeight: FontWeight.w500, color: Colors.white),
children: [TextSpan(text: ".${NumberFormat("000", LocaleSettings.currentLocale.languageCode).format(time.inMilliseconds%1000)}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))] children: [TextSpan(text: ".${NumberFormat("000", LocaleSettings.currentLocale.languageCode).format(time.inMilliseconds%1000)}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))]
) : const TextSpan(
text: "-:--",
style: TextStyle(fontFamily: "Eurostile Round", fontSize: 22, fontWeight: FontWeight.w500, color: Colors.grey),
children: [TextSpan(text: ".---", style: TextStyle(fontFamily: "Eurostile Round", fontSize: 14, fontWeight: FontWeight.w100))]
), ),
), ),
title: Text(widget.record.results.rounds[index][0].username, textAlign: TextAlign.center), title: Text(widget.record.results.rounds[index][0].username, textAlign: TextAlign.center),