Commit 3e49f849 authored by DeepDaikon's avatar DeepDaikon
Browse files

Fix ranking

parent db98468d
......@@ -39,11 +39,11 @@ class _RankingPageState extends State<RankingPage> {
},
itemBuilder: (BuildContext context) => <PopupMenuEntry<int>>[
const PopupMenuItem<int>(
value: 3,
value: 4,
child: Text('Moves'),
),
const PopupMenuItem<int>(
value: 4,
value: 5,
child: Text('Points'),
),
]),
......
......@@ -2,14 +2,13 @@ import 'package:zoysii/src/resources/globals.dart';
int sorter = 4;
int filter;
var shownResults = results.where((result) => result[2] >= 0).toList();
List<List<int>> shownResults = [];
// Sort ranking list
sortList(int element) {
int order;
switch (element) {
case 3: order = 1; break;
case 4: order = -1; break;
case 5: order = -1; break;
default: order = 1; break;
}
shownResults.sort((n0, n1) => order * (n0[element] - n1[element]));
......@@ -17,5 +16,6 @@ sortList(int element) {
// Filter ranking list
filterList(int size) {
shownResults = shownResults.where((result) => result[3] == size).toList();
shownResults =
results.where((result) => result[3] == size && result[2] >= 0).toList();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment