From 7c2692d668a24b222ff4f007c44f51a31a48fa52 Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Mon, 17 May 2021 15:30:53 +0200 Subject: [PATCH 01/57] prepare package and change example --- client/lib/widgets/social_menu_widgets/friends.dart | 1 + client/pubspec.lock | 7 +++++++ maptogether_api/example/maptogether_api_example.dart | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 1a8963a..34372b1 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'User.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; +import 'package:maptogether_api/maptogether_api.dart'; //TODO: move friends list to a seperate file or server class Friends extends StatelessWidget { diff --git a/client/pubspec.lock b/client/pubspec.lock index d02e5de..87874e0 100644 --- a/client/pubspec.lock +++ b/client/pubspec.lock @@ -212,6 +212,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.11.4" + maptogether_api: + dependency: "direct main" + description: + path: "../maptogether_api" + relative: true + source: path + version: "0.1.0" matcher: dependency: transitive description: diff --git a/maptogether_api/example/maptogether_api_example.dart b/maptogether_api/example/maptogether_api_example.dart index b91b9cd..430b5ab 100644 --- a/maptogether_api/example/maptogether_api_example.dart +++ b/maptogether_api/example/maptogether_api_example.dart @@ -1,7 +1,19 @@ +import 'dart:math'; + import 'package:maptogether_api/maptogether_api.dart'; +import '../lib/src/data.dart'; + void main() { final api = MapTogetherApi(); api.user(1).then(print); api.globalLeaderboard(LeaderboardType.all_time).then(print); + + api.globalLeaderboard(LeaderboardType.all_time).then((l) { + for(var e in l.entries) + print(e.user.name); + print(l); + }); + } + From 929db5e1a2c846ea52ec66e5e24c51ef70373f2f Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Tue, 18 May 2021 12:03:29 +0200 Subject: [PATCH 02/57] Rename User class for dummy data to not interfere with API --- client/lib/database.dart | 28 ++--- client/lib/screens/login_screen.dart | 3 +- .../social_menu_widgets/Leaderboard.dart | 18 ++- .../lib/widgets/social_menu_widgets/User.dart | 4 +- .../widgets/social_menu_widgets/friends.dart | 103 +++++++++++------- .../widgets/social_menu_widgets/overview.dart | 45 ++++---- .../social_menu_widgets/user_overview.dart | 2 +- maptogether_api/lib/maptogether_api.dart | 1 + 8 files changed, 119 insertions(+), 85 deletions(-) diff --git a/client/lib/database.dart b/client/lib/database.dart index cb23c5e..3b06420 100644 --- a/client/lib/database.dart +++ b/client/lib/database.dart @@ -9,24 +9,24 @@ class DummyDatabase with ChangeNotifier{ String loginURL = ""; String currentUserName; - User currentUser; + UserTest currentUser; - List globalUsers; - List leaderboards; + List globalUsers; + List leaderboards; List followingNames; - List following; + List following; DummyDatabase() { currentUserName = "Simon"; //This is the list of all users to ever use the app, it makes up the global leaderboard. globalUsers = [ - User("Thomas", 40, 25, 15, "kid.png", "UK"), - User("Sebba", 250, 150, 55, "clean.png", "DK"), - User("Simon", 25, 15, 5, "business.png", "DK"), - User("Phillip", 55, 35, 15, "arthas.png", "DK"), - User("Hartvig", 10, 10, 0, "anime.png", "JP"), - User("Fjeldsø", 20, 20, 10, "wolf.png", "DK"), + UserTest("Thomas", 40, 25, 15, "kid.png", "UK"), + UserTest("Sebba", 250, 150, 55, "clean.png", "DK"), + UserTest("Simon", 25, 15, 5, "business.png", "DK"), + UserTest("Phillip", 55, 35, 15, "arthas.png", "DK"), + UserTest("Hartvig", 10, 10, 0, "anime.png", "JP"), + UserTest("Fjeldsø", 20, 20, 10, "wolf.png", "DK"), ]; followingNames = [ @@ -42,16 +42,16 @@ class DummyDatabase with ChangeNotifier{ user.name == currentUserName); //Setting up Leaderboards - LeaderBoard national = new LeaderBoard(currentUser.nationality, + LeaderBoardTest national = new LeaderBoardTest(currentUser.nationality, globalUsers.where((user) => user.nationality == currentUser.nationality) .toList()); following = globalUsers.where((user) => followingNames.contains(user.name)).toList(); - LeaderBoard world = new LeaderBoard("World", globalUsers); + LeaderBoardTest world = new LeaderBoardTest("World", globalUsers); - LeaderBoard followLB = new LeaderBoard("Follow", following); + LeaderBoardTest followLB = new LeaderBoardTest("Follow", following); leaderboards = [world, national, followLB]; @@ -64,7 +64,7 @@ class DummyDatabase with ChangeNotifier{ } void followNew(String toFollow){ - User userToFollow = globalUsers.firstWhere((user) => user.name == toFollow, orElse: () => null); + UserTest userToFollow = globalUsers.firstWhere((user) => user.name == toFollow, orElse: () => null); if(userToFollow == null) print("User does not exist"); diff --git a/client/lib/screens/login_screen.dart b/client/lib/screens/login_screen.dart index dac0781..559907c 100644 --- a/client/lib/screens/login_screen.dart +++ b/client/lib/screens/login_screen.dart @@ -116,5 +116,4 @@ class LoginWebView extends StatelessWidget{ ], ) ); - } - + } \ No newline at end of file diff --git a/client/lib/widgets/social_menu_widgets/Leaderboard.dart b/client/lib/widgets/social_menu_widgets/Leaderboard.dart index ba1a175..2ae7982 100644 --- a/client/lib/widgets/social_menu_widgets/Leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/Leaderboard.dart @@ -3,15 +3,16 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:client/database.dart'; +import 'package:maptogether_api/maptogether_api.dart'; import 'package:provider/provider.dart'; import 'User.dart'; -class LeaderBoard{ +class LeaderBoardTest{ String name; - List users; + List users; - LeaderBoard(this.name, this.users){ + LeaderBoardTest(this.name, this.users){ users.sort((a, b) => b.total.compareTo(a.total)); } } @@ -77,3 +78,14 @@ class LeaderBoardView extends StatelessWidget{ } } +Future> getLeaderboards(MapTogetherApi api) async{ + //This should call to get all the leaderboards in the future + await api.globalLeaderboard(LeaderboardType.all_time).then((l) { + for(var e in l.entries) + print(e.user.name); + List lst = [l]; + return lst; + + }); +} + diff --git a/client/lib/widgets/social_menu_widgets/User.dart b/client/lib/widgets/social_menu_widgets/User.dart index d8229e5..4976b57 100644 --- a/client/lib/widgets/social_menu_widgets/User.dart +++ b/client/lib/widgets/social_menu_widgets/User.dart @@ -1,4 +1,4 @@ -class User { +class UserTest { String name; //name of user int total; int weekly; @@ -9,5 +9,5 @@ class User { //weekly/daily score ved bare at tage ting i et specifikt interval - User(this.name, this.total, this.weekly, this.daily, this.pfp, this.nationality); + UserTest(this.name, this.total, this.weekly, this.daily, this.pfp, this.nationality); } \ No newline at end of file diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 34372b1..f29732d 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -1,3 +1,4 @@ +import 'package:client/widgets/social_menu_widgets/Leaderboard.dart'; import 'package:client/widgets/social_menu_widgets/newFriend.dart'; import 'package:flutter/material.dart'; import 'User.dart'; @@ -5,56 +6,80 @@ import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; + //TODO: move friends list to a seperate file or server class Friends extends StatelessWidget { - @override Widget build(BuildContext context) { + final api = MapTogetherApi(); + return Container( margin: EdgeInsets.all(40.0), child: Column( children: [ Expanded(flex: 1, child: Text("Following")), - Expanded( - flex: 7, - child: ListView.builder( - itemCount: context.watch().following.length, - itemBuilder: (context, index) { - return Card( - child: ListTile( - onLongPress: () { - showModalBottomSheet ( - context: context, - builder: (BuildContext context) { - return Container( - height: 100, - color: Colors.orange, - child: Center( - child: TextButton( - child: Text("Unfollow"), - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: Colors.red - ), - onPressed: (){ - context.read().followingNames.remove(context.read().following[index].name); - context.read().following.removeAt(index); - Navigator.pop(context); - }, - ), - ), + FutureBuilder( + future: api.globalLeaderboard(LeaderboardType.all_time), + builder: (BuildContext context, AsyncSnapshot snapshot) { + return Expanded( + flex: 7, + child: ListView.builder( + itemCount: context + .watch() + .following + .length, + itemBuilder: (context, index) { + return Card( + child: ListTile( + onLongPress: () { + showModalBottomSheet ( + context: context, + builder: (BuildContext context) { + return Container( + height: 100, + color: Colors.orange, + child: Center( + child: TextButton( + child: Text("Unfollow"), + style: TextButton.styleFrom( + primary: Colors.white, + backgroundColor: Colors.red + ), + onPressed: () { + context + .read() + .followingNames + .remove(context + .read() + .following[index].name); + context + .read() + .following + .removeAt(index); + Navigator.pop(context); + }, + ), + ), + ); + } ); - } + }, + title: Text(context + .watch() + .following[index].name), + leading: CircleAvatar( + backgroundImage: + AssetImage('assets/${context + .watch() + .following[index].pfp}'), + ), + ), ); - }, - title: Text(context.watch().following[index].name), - leading: CircleAvatar( - backgroundImage: - AssetImage('assets/${context.watch().following[index].pfp}'), - ), - ), - ); - })), + } + ) + ); + } + ), Expanded( flex: 1, child: Padding( diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index 73ca754..ce3cc98 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -1,5 +1,6 @@ import 'package:client/widgets/social_menu_widgets/user_overview.dart'; import 'package:flutter/material.dart'; +import 'package:maptogether_api/maptogether_api.dart'; import 'Leaderboard.dart'; import 'User.dart'; import 'package:client/database.dart'; @@ -14,6 +15,7 @@ class Overview extends StatefulWidget { class _OverviewView extends State with TickerProviderStateMixin{ //We get All, Weekly and Daily from the index of the tabcontroller, changes depending on which leaderboards we are interested in, 0 = daily, 1 = weekly, 2 = all TabController _nestedTabController; + final api = MapTogetherApi(); @override void initState(){ @@ -73,33 +75,28 @@ class _OverviewView extends State with TickerProviderStateMixin{ } - Widget leaderBoardWidget(String type) => Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: ListView.builder( - itemCount: context.watch().leaderboards.length, - itemBuilder: (context, index){ - return Card( - child: ListTile( - title: Text("#" - + ((context.watch().leaderboards[index].users.indexOf(context.watch().currentUser)+1).toString()) - + "/" - + (context.watch().leaderboards[index].users.length).toString()), - leading: Text(context.watch().leaderboards[index].name), - onTap: (){ - Navigator.push(context, - MaterialPageRoute( - builder: (context) => LeaderBoardView(leaderboardIndex: index),)); - }, - - ) + Widget leaderBoardWidget(String type) => Expanded( + child: ListView.builder( + itemCount: context.watch().leaderboards.length, + itemBuilder: (context, index){ + return Card( + child: ListTile( + title: Text("#" + + ((context.watch().leaderboards[index].users.indexOf(context.watch().currentUser)+1).toString()) + + "/" + + (context.watch().leaderboards[index].users.length).toString()), + leading: Text(context.watch().leaderboards[index].name), + onTap: (){ + Navigator.push(context, + MaterialPageRoute( + builder: (context) => LeaderBoardView(leaderboardIndex: index),)); + }, + + ) ); } ) - ) - ], - ); + ); } diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 7d36f70..3dc1b60 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -7,7 +7,7 @@ import 'Leaderboard.dart'; class UserOverView extends StatelessWidget { @override Widget build(BuildContext context) { - for(LeaderBoard l in context.watch().leaderboards) { + for(LeaderBoardTest l in context.watch().leaderboards) { l.users.sort((a, b) => b.total.compareTo(a.total)); } return Container( diff --git a/maptogether_api/lib/maptogether_api.dart b/maptogether_api/lib/maptogether_api.dart index b660ec4..8fb7a13 100644 --- a/maptogether_api/lib/maptogether_api.dart +++ b/maptogether_api/lib/maptogether_api.dart @@ -1,3 +1,4 @@ library maptogether_api; export 'src/api.dart'; +export 'src/data.dart'; From f87f7a20d58ee5c4a22f247b9cc839d43b5d9b62 Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Tue, 18 May 2021 15:54:55 +0200 Subject: [PATCH 03/57] Ledaerboard outer now works --- .../social_menu_widgets/Leaderboard.dart | 12 --- .../widgets/social_menu_widgets/friends.dart | 17 ++--- .../widgets/social_menu_widgets/overview.dart | 73 ++++++++++++------- .../example/maptogether_api_example.dart | 5 +- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/client/lib/widgets/social_menu_widgets/Leaderboard.dart b/client/lib/widgets/social_menu_widgets/Leaderboard.dart index 2ae7982..596ab96 100644 --- a/client/lib/widgets/social_menu_widgets/Leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/Leaderboard.dart @@ -77,15 +77,3 @@ class LeaderBoardView extends StatelessWidget{ ); } } - -Future> getLeaderboards(MapTogetherApi api) async{ - //This should call to get all the leaderboards in the future - await api.globalLeaderboard(LeaderboardType.all_time).then((l) { - for(var e in l.entries) - print(e.user.name); - List lst = [l]; - return lst; - - }); -} - diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index f29732d..dd51e13 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -14,23 +14,21 @@ class Friends extends StatelessWidget { final api = MapTogetherApi(); return Container( - margin: EdgeInsets.all(40.0), child: Column( children: [ - Expanded(flex: 1, child: Text("Following")), FutureBuilder( future: api.globalLeaderboard(LeaderboardType.all_time), builder: (BuildContext context, AsyncSnapshot snapshot) { return Expanded( - flex: 7, - child: ListView.builder( + flex: 14, + child: ListView.separated( + separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 2, height: 2), itemCount: context .watch() .following .length, itemBuilder: (context, index) { - return Card( - child: ListTile( + return ListTile( onLongPress: () { showModalBottomSheet ( context: context, @@ -73,17 +71,16 @@ class Friends extends StatelessWidget { .watch() .following[index].pfp}'), ), - ), - ); + ); } ) ); } ), Expanded( - flex: 1, + flex: 2, child: Padding( - padding: const EdgeInsets.all(10), + padding: const EdgeInsets.all(10.0), child: Container( color: Colors.lightGreen, child: TextButton( diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index ce3cc98..653da33 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -15,7 +15,6 @@ class Overview extends StatefulWidget { class _OverviewView extends State with TickerProviderStateMixin{ //We get All, Weekly and Daily from the index of the tabcontroller, changes depending on which leaderboards we are interested in, 0 = daily, 1 = weekly, 2 = all TabController _nestedTabController; - final api = MapTogetherApi(); @override void initState(){ @@ -65,9 +64,9 @@ class _OverviewView extends State with TickerProviderStateMixin{ child: TabBarView( controller: _nestedTabController, children: [ - leaderBoardWidget("1"), - leaderBoardWidget("2"), - leaderBoardWidget("3"), + leaderBoardWidget(LeaderboardType.weekly), + leaderBoardWidget(LeaderboardType.montly), + leaderBoardWidget(LeaderboardType.all_time), ]) ) ], @@ -75,29 +74,53 @@ class _OverviewView extends State with TickerProviderStateMixin{ } - Widget leaderBoardWidget(String type) => Expanded( - child: ListView.builder( - itemCount: context.watch().leaderboards.length, - itemBuilder: (context, index){ - return Card( - child: ListTile( - title: Text("#" - + ((context.watch().leaderboards[index].users.indexOf(context.watch().currentUser)+1).toString()) - + "/" - + (context.watch().leaderboards[index].users.length).toString()), - leading: Text(context.watch().leaderboards[index].name), - onTap: (){ - Navigator.push(context, - MaterialPageRoute( - builder: (context) => LeaderBoardView(leaderboardIndex: index),)); - }, - - ) - ); - } - ) + Widget leaderBoardWidget(LeaderboardType type) => + FutureBuilder( + future: getLeaderboards(), + builder: (BuildContext context, AsyncSnapshot> snapshot) { + if (snapshot.hasData) { + return ListView.builder( + itemCount: snapshot.data.length, + itemBuilder: (context, index) { + return Card( + child: ListTile( + title: Text("#" + + ((snapshot.data[index].entries.indexWhere((element) => element.user.name == "Peer") + 1).toString()) + + "/" + + (snapshot.data[index].entries.length).toString()), + leading: Text("World"), //TODO: API should let us retrieve a leaderboard name + onTap: () { + Navigator.push(context, + MaterialPageRoute( + builder: (context) => + LeaderBoardView( + leaderboardIndex: index),)); + }, + ) + ); + } + ); + } + + else { + return SizedBox( + child: CircularProgressIndicator(), + width: 60, + height: 60, + ); + } + } ); } +Future> getLeaderboards() async{ + //This should call to get all the leaderboards in the future + final api = MapTogetherApi(); + var l = await api.globalLeaderboard(LeaderboardType.all_time); + List lst = [l]; + return lst; +} + + diff --git a/maptogether_api/example/maptogether_api_example.dart b/maptogether_api/example/maptogether_api_example.dart index 430b5ab..521d99a 100644 --- a/maptogether_api/example/maptogether_api_example.dart +++ b/maptogether_api/example/maptogether_api_example.dart @@ -10,9 +10,8 @@ void main() { api.globalLeaderboard(LeaderboardType.all_time).then(print); api.globalLeaderboard(LeaderboardType.all_time).then((l) { - for(var e in l.entries) - print(e.user.name); - print(l); + print(l.type); + }); } From 1e28825e5c45200f72a7f9b49b842a663bd69876 Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Wed, 19 May 2021 09:42:24 +0200 Subject: [PATCH 04/57] Follower page shows server data --- .../widgets/social_menu_widgets/friends.dart | 148 ++++++++++-------- .../social_menu_widgets/user_overview.dart | 1 + .../example/maptogether_api_example.dart | 5 +- 3 files changed, 85 insertions(+), 69 deletions(-) diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index dd51e13..6aec1b4 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -16,88 +16,100 @@ class Friends extends StatelessWidget { return Container( child: Column( children: [ - FutureBuilder( - future: api.globalLeaderboard(LeaderboardType.all_time), - builder: (BuildContext context, AsyncSnapshot snapshot) { + FutureBuilder( + future: getUser(), + builder: (BuildContext context, AsyncSnapshot user) { + if (user.hasData) { return Expanded( flex: 14, child: ListView.separated( - separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 2, height: 2), - itemCount: context - .watch() - .following - .length, + separatorBuilder: (BuildContext context, int index) => + const Divider(thickness: 2, height: 2), + itemCount: user.data.following.length, itemBuilder: (context, index) { return ListTile( - onLongPress: () { - showModalBottomSheet ( - context: context, - builder: (BuildContext context) { - return Container( - height: 100, - color: Colors.orange, - child: Center( - child: TextButton( - child: Text("Unfollow"), - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: Colors.red - ), - onPressed: () { - context - .read() - .followingNames - .remove(context - .read() - .following[index].name); - context - .read() - .following - .removeAt(index); - Navigator.pop(context); - }, + onLongPress: () { + showModalBottomSheet ( + context: context, + builder: (BuildContext context) { + return Container( + height: 100, + color: Colors.orange, + child: Center( + child: TextButton( + child: Text("Unfollow"), + style: TextButton.styleFrom( + primary: Colors.white, + backgroundColor: Colors.red ), + onPressed: () { + context + .read() + .followingNames + .remove(context + .read() + .following[index].name); + context + .read() + .following + .removeAt(index); + Navigator.pop(context); + }, ), - ); - } - ); - }, - title: Text(context - .watch() - .following[index].name), - leading: CircleAvatar( - backgroundImage: - AssetImage('assets/${context - .watch() - .following[index].pfp}'), - ), - ); + ), + ); + } + ); + }, + title: Text(user.data.following[index].name), + leading: CircleAvatar( + backgroundImage: + AssetImage('assets/business.png'), + ), + ); } ) ); } - ), - Expanded( - flex: 2, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - color: Colors.lightGreen, - child: TextButton( - child: Text( - 'Follow New', - style: TextStyle(fontSize: 20.0, color: Colors.white), + else { + return Expanded( + flex: 14, + child: SizedBox( + child: CircularProgressIndicator(), + width: 60, + height: 60) + ); + } + } + ), + Expanded( + flex: 2, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + color: Colors.lightGreen, + child: TextButton( + child: Text( + 'Follow New', + style: TextStyle(fontSize: 20.0, color: Colors.white), + ), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => NewFriend())); + }, ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => NewFriend())); - }, ), ), ), - ), - ], - ), - ); + ], + ), + ); + } } + +Future getUser() async{ + //This should call to get all the leaderboards in the future + final api = MapTogetherApi(); + var user = await api.user(2); + return user; } diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 3dc1b60..23c453d 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'Leaderboard.dart'; +import 'package:maptogether_api/maptogether_api.dart'; class UserOverView extends StatelessWidget { @override diff --git a/maptogether_api/example/maptogether_api_example.dart b/maptogether_api/example/maptogether_api_example.dart index 521d99a..2790f37 100644 --- a/maptogether_api/example/maptogether_api_example.dart +++ b/maptogether_api/example/maptogether_api_example.dart @@ -8,10 +8,13 @@ void main() { final api = MapTogetherApi(); api.user(1).then(print); api.globalLeaderboard(LeaderboardType.all_time).then(print); - + api.globalLeaderboard(LeaderboardType.all_time).then((l) { print(l.type); + for(var t in l.entries) + print(t.score); + print("æøå ÆØÅ"); }); } From 8d841dc1e72c1b0e474039674ae3f5ace48f9386 Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Wed, 19 May 2021 10:00:21 +0200 Subject: [PATCH 05/57] add data_fetcher and user_overview now fetches server data --- client/lib/data_fetchers.dart | 16 ++++ .../widgets/social_menu_widgets/friends.dart | 7 +- .../widgets/social_menu_widgets/overview.dart | 21 ++--- .../social_menu_widgets/user_overview.dart | 92 ++++++++++++------- 4 files changed, 82 insertions(+), 54 deletions(-) create mode 100644 client/lib/data_fetchers.dart diff --git a/client/lib/data_fetchers.dart b/client/lib/data_fetchers.dart new file mode 100644 index 0000000..d234122 --- /dev/null +++ b/client/lib/data_fetchers.dart @@ -0,0 +1,16 @@ +import 'package:maptogether_api/maptogether_api.dart'; + +Future getUser() async{ + //This should call to get all the leaderboards in the future + final api = MapTogetherApi(); + var user = await api.user(2); + return user; +} + +Future> getLeaderboards(LeaderboardType type) async{ + //This should call to get all the leaderboards in the future + final api = MapTogetherApi(); + var l = await api.globalLeaderboard(type); + List lst = [l]; + return lst; +} \ No newline at end of file diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 6aec1b4..8861d01 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -5,6 +5,7 @@ import 'User.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; +import 'package:client/data_fetchers.dart'; //TODO: move friends list to a seperate file or server @@ -107,9 +108,3 @@ class Friends extends StatelessWidget { } } -Future getUser() async{ - //This should call to get all the leaderboards in the future - final api = MapTogetherApi(); - var user = await api.user(2); - return user; -} diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index 653da33..059d305 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -5,6 +5,7 @@ import 'Leaderboard.dart'; import 'User.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; +import 'package:client/data_fetchers.dart'; class Overview extends StatefulWidget { @@ -48,13 +49,13 @@ class _OverviewView extends State with TickerProviderStateMixin{ tabs: [ Tab( - text: "Daily", + text: "All Time", ), Tab( - text: "Weekly", + text: "Monthly", ), Tab( - text: "All Time", + text: "Weekly", ), ] ), @@ -64,9 +65,9 @@ class _OverviewView extends State with TickerProviderStateMixin{ child: TabBarView( controller: _nestedTabController, children: [ - leaderBoardWidget(LeaderboardType.weekly), - leaderBoardWidget(LeaderboardType.montly), leaderBoardWidget(LeaderboardType.all_time), + leaderBoardWidget(LeaderboardType.montly), + leaderBoardWidget(LeaderboardType.weekly), ]) ) ], @@ -76,7 +77,7 @@ class _OverviewView extends State with TickerProviderStateMixin{ Widget leaderBoardWidget(LeaderboardType type) => FutureBuilder( - future: getLeaderboards(), + future: getLeaderboards(type), builder: (BuildContext context, AsyncSnapshot> snapshot) { if (snapshot.hasData) { return ListView.builder( @@ -113,14 +114,6 @@ class _OverviewView extends State with TickerProviderStateMixin{ ); } -Future> getLeaderboards() async{ - //This should call to get all the leaderboards in the future - final api = MapTogetherApi(); - var l = await api.globalLeaderboard(LeaderboardType.all_time); - List lst = [l]; - return lst; -} - diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 23c453d..5e314c3 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -4,46 +4,70 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'Leaderboard.dart'; import 'package:maptogether_api/maptogether_api.dart'; +import 'package:client/data_fetchers.dart'; class UserOverView extends StatelessWidget { @override Widget build(BuildContext context) { - for(LeaderBoardTest l in context.watch().leaderboards) { - l.users.sort((a, b) => b.total.compareTo(a.total)); - } - return Container( - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 100, - height: 100, - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - image: AssetImage('assets/${context.watch().currentUser.pfp}'), - ) - ) + return FutureBuilder( + future: getUser(), + builder: (BuildContext context, AsyncSnapshot user) { + if (user.hasData) { + return Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + width: 100, + height: 100, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage('assets/business.png'), + ) + ) - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text("Daily : " + context.watch().currentUser.daily.toString(), - style: TextStyle(fontFamily: 'RobotoMono', fontSize: 18, color: Colors.lightGreen, fontWeight: FontWeight.bold), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text("Weekly : " + user.data.score.toString(), + style: TextStyle(fontFamily: 'RobotoMono', + fontSize: 18, + color: Colors.lightGreen, + fontWeight: FontWeight.bold), + ), + Text("Monthly : " + user.data.score.toString(), + style: TextStyle(fontFamily: 'RobotoMono', + fontSize: 18, + color: Colors.lightGreen, + fontWeight: FontWeight.bold), + ), + Text("All time : " + user.data.score.toString(), + style: TextStyle(fontFamily: 'RobotoMono', + fontSize: 18, + color: Colors.lightGreen, + fontWeight: FontWeight.bold + ) + ) + ], + ) + ], ), - Text("Weekly : " + context.watch().currentUser.weekly.toString(), - style: TextStyle(fontFamily: 'RobotoMono', fontSize: 18, color: Colors.lightGreen, fontWeight: FontWeight.bold), - ), - Text("All time : " + context.watch().currentUser.total.toString(), - style: TextStyle(fontFamily: 'RobotoMono', fontSize: 18, color:Colors.lightGreen, fontWeight: FontWeight.bold - ) - ) - ], - ) - ], - ), + ); + } + + else{ + return Container( + padding: EdgeInsets.all(10.0), + child: SizedBox( + child: CircularProgressIndicator(), + width: 60, + height: 60) + ); + } + } ); } } From 239130d031a8fd5ecb5b5a91796ef52fdb472d0d Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Wed, 19 May 2021 10:32:15 +0200 Subject: [PATCH 06/57] follow list is loaded as single entity --- .../widgets/social_menu_widgets/friends.dart | 158 +++++++++--------- 1 file changed, 80 insertions(+), 78 deletions(-) diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 8861d01..7309d70 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -15,96 +15,98 @@ class Friends extends StatelessWidget { final api = MapTogetherApi(); return Container( - child: Column( - children: [ - FutureBuilder( + child: FutureBuilder( future: getUser(), builder: (BuildContext context, AsyncSnapshot user) { if (user.hasData) { - return Expanded( - flex: 14, - child: ListView.separated( - separatorBuilder: (BuildContext context, int index) => - const Divider(thickness: 2, height: 2), - itemCount: user.data.following.length, - itemBuilder: (context, index) { - return ListTile( - onLongPress: () { - showModalBottomSheet ( - context: context, - builder: (BuildContext context) { - return Container( - height: 100, - color: Colors.orange, - child: Center( - child: TextButton( - child: Text("Unfollow"), - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: Colors.red + return Column( + children: [ + Expanded( + flex: 14, + child: ListView.separated( + separatorBuilder: (BuildContext context, + int index) => + const Divider(thickness: 2, height: 2), + itemCount: user.data.following.length, + itemBuilder: (context, index) { + return ListTile( + onLongPress: () { + showModalBottomSheet ( + context: context, + builder: (BuildContext context) { + return Container( + height: 100, + color: Colors.orange, + child: Center( + child: TextButton( + child: Text("Unfollow"), + style: TextButton.styleFrom( + primary: Colors.white, + backgroundColor: Colors.red + ), + onPressed: () { + context + .read() + .followingNames + .remove(context + .read() + .following[index].name); + context + .read() + .following + .removeAt(index); + Navigator.pop(context); + }, + ), ), - onPressed: () { - context - .read() - .followingNames - .remove(context - .read() - .following[index].name); - context - .read() - .following - .removeAt(index); - Navigator.pop(context); - }, - ), - ), - ); - } + ); + } + ); + }, + title: Text(user.data.following[index].name), + leading: CircleAvatar( + backgroundImage: + AssetImage('assets/business.png'), + ), ); - }, - title: Text(user.data.following[index].name), - leading: CircleAvatar( - backgroundImage: - AssetImage('assets/business.png'), + } + ) + ), + Expanded( + flex: 2, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + color: Colors.lightGreen, + child: TextButton( + child: Text( + 'Follow New', + style: TextStyle( + fontSize: 20.0, color: Colors.white), ), - ); - } - ) + onPressed: () { + Navigator.push(context, + MaterialPageRoute( + builder: (context) => NewFriend())); + }, + ), + ), + ), + ), + ], ); } else { return Expanded( - flex: 14, - child: SizedBox( - child: CircularProgressIndicator(), - width: 60, - height: 60) + flex: 14, + child: SizedBox( + child: CircularProgressIndicator(), + width: 60, + height: 60) ); } } - ), - Expanded( - flex: 2, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - color: Colors.lightGreen, - child: TextButton( - child: Text( - 'Follow New', - style: TextStyle(fontSize: 20.0, color: Colors.white), - ), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => NewFriend())); - }, - ), - ), - ), - ), - ], - ), - ); - } + )); } +} From f2bb9af318a89b3f289d1d31059d3df4252ec49f Mon Sep 17 00:00:00 2001 From: Hartvigen Date: Wed, 19 May 2021 14:20:19 +0200 Subject: [PATCH 07/57] add expanded leaderboard view, fetch less data for leaderboard overview --- client/lib/data_fetchers.dart | 33 ++++- client/lib/database.dart | 10 +- client/lib/main.dart | 3 +- .../social_menu_widgets/Leaderboard.dart | 114 +++++++++--------- .../widgets/social_menu_widgets/friends.dart | 9 +- .../widgets/social_menu_widgets/overview.dart | 31 +++-- .../social_menu_widgets/user_overview.dart | 9 +- .../example/maptogether_api_example.dart | 8 +- 8 files changed, 125 insertions(+), 92 deletions(-) diff --git a/client/lib/data_fetchers.dart b/client/lib/data_fetchers.dart index d234122..c8ee6aa 100644 --- a/client/lib/data_fetchers.dart +++ b/client/lib/data_fetchers.dart @@ -1,5 +1,8 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:maptogether_api/maptogether_api.dart'; + Future getUser() async{ //This should call to get all the leaderboards in the future final api = MapTogetherApi(); @@ -7,10 +10,32 @@ Future getUser() async{ return user; } -Future> getLeaderboards(LeaderboardType type) async{ +Future getLeaderboard(LeaderboardType type, String name) async{ //This should call to get all the leaderboards in the future final api = MapTogetherApi(); - var l = await api.globalLeaderboard(type); - List lst = [l]; - return lst; + var lb = await api.leaderboard(name, type); + //var regional = await api.regionalLeaderboard("Denmark", type); + //var follower = await api.personalLeaderboard(type); + return lb; +} + +SizedBox waitingLoop() { + return SizedBox( + child: CircularProgressIndicator(), + width: 60, + height: 60, + ); +} + +Widget errorData() { + return Icon( + Icons.error_outline, + color: Colors.red, + size: 60, + ); +} + +//should return the full list of leaderboard names +List getLeaderboardNames(){ + return ["global"]; } \ No newline at end of file diff --git a/client/lib/database.dart b/client/lib/database.dart index 3b06420..67ea7aa 100644 --- a/client/lib/database.dart +++ b/client/lib/database.dart @@ -1,10 +1,18 @@ -import 'package:client/widgets/social_menu_widgets/Leaderboard.dart'; import 'package:client/widgets/social_menu_widgets/User.dart'; import 'package:flutter/foundation.dart'; //We get the current user through their username, usernames are unique, //for the purpose of testing we are Simon +class LeaderBoardTest{ + String name; + List users; + + LeaderBoardTest(this.name, this.users){ + users.sort((a, b) => b.total.compareTo(a.total)); + } +} + class DummyDatabase with ChangeNotifier{ String loginURL = ""; diff --git a/client/lib/main.dart b/client/lib/main.dart index 73c1d28..3b00c4c 100644 --- a/client/lib/main.dart +++ b/client/lib/main.dart @@ -4,6 +4,7 @@ import 'package:client/screens/map_screen.dart'; import 'package:client/login_handler.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:maptogether_api/maptogether_api.dart'; import 'database.dart'; @@ -12,7 +13,7 @@ void main() => runApp( ChangeNotifierProvider(create: (_) => DummyDatabase()), ChangeNotifierProvider(create: (_) => LoginHandler()), ChangeNotifierProvider(create: (_) => LocationHandler()), - ChangeNotifierProvider(create: (_) => QuestHandler()), + ChangeNotifierProvider(create: (_) => QuestHandler()) ], child: MyApp()), ); diff --git a/client/lib/widgets/social_menu_widgets/Leaderboard.dart b/client/lib/widgets/social_menu_widgets/Leaderboard.dart index 596ab96..0a7bbed 100644 --- a/client/lib/widgets/social_menu_widgets/Leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/Leaderboard.dart @@ -6,74 +6,72 @@ import 'package:client/database.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'package:provider/provider.dart'; +import '../../data_fetchers.dart'; import 'User.dart'; -class LeaderBoardTest{ - String name; - List users; - - LeaderBoardTest(this.name, this.users){ - users.sort((a, b) => b.total.compareTo(a.total)); - } -} - class LeaderBoardView extends StatelessWidget{ int leaderboardIndex; - LeaderBoardView({Key key, @required this.leaderboardIndex}) : super(key: key); + String leaderBoardName; + LeaderboardType type; + LeaderBoardView({Key key, @required this.leaderBoardName, @required this.type}) : super(key: key); @override Widget build(BuildContext context){ - var curLeaderboard = context.watch().leaderboards[leaderboardIndex]; - //we sort the list whenever we open the list, such that it is in correct order in case of updates to the database - curLeaderboard.users.sort((a, b) => b.total.compareTo(a.total)); - return Scaffold( - appBar: MapTogetherAppBar( - title: "Leaderboard for " + curLeaderboard.name, - actions: [], - ), - body: Center( - child: Container( - margin: EdgeInsets.all(40.0), - child: Column( - children: [ - Expanded( - child: ListView.builder( - itemCount: curLeaderboard.users.length, - itemBuilder: (context, index){ - return Card( - child: ListTile( - title: Text("#" - + (index+1).toString() - + " " - + curLeaderboard.users[index].name - + " : " - + curLeaderboard.users[index].total.toString() - + " points"), + return FutureBuilder( + future: getLeaderboard(type, leaderBoardName), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if(snapshot.hasData) { + return Scaffold( + appBar: MapTogetherAppBar( + title: "Leaderboard for " + leaderBoardName, + actions: [], + ), + body: Center( + child: Container( + margin: EdgeInsets.all(40.0), + child: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: snapshot.data.entries.length, + itemBuilder: (context, index) { + return Card( + child: ListTile( + title: Text("#" + + (index + 1).toString() + + " " + + snapshot.data.entries[index].user.name + + " : " + + snapshot.data.entries[index].score.toString() + + " points"), + + leading: CircleAvatar( + backgroundImage: + AssetImage('assets/business.png'), + + ), + ), + ); + }), + ), + ] + ) + ) + ) + ); + } + else if(snapshot.hasError) + return errorData(); - leading: CircleAvatar( - backgroundImage: - AssetImage('assets/${curLeaderboard.users[index].pfp}'), + else { + return Expanded( + flex: 14, + child: waitingLoop()); + } + } + ); - ), - ), - ); - }), - ), - TextButton( - onPressed: (){ - for(int x = 0; x < curLeaderboard.users.length; x++) - if(curLeaderboard.users[x].name == context.read().currentUserName) - Provider.of(context, listen: false).givePoints(10); - curLeaderboard.users.sort((a, b) => b.total.compareTo(a.total)); - }, - child: Text("+++++") - ) - ] - ) - ) - ) - ); } } diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 7309d70..0859303 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -96,14 +96,13 @@ class Friends extends StatelessWidget { ], ); } + else if(user.hasError) + return errorData(); + else { return Expanded( flex: 14, - child: SizedBox( - child: CircularProgressIndicator(), - width: 60, - height: 60) - ); + child: waitingLoop()); } } )); diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index 059d305..2e4d027 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -16,6 +16,7 @@ class Overview extends StatefulWidget { class _OverviewView extends State with TickerProviderStateMixin{ //We get All, Weekly and Daily from the index of the tabcontroller, changes depending on which leaderboards we are interested in, 0 = daily, 1 = weekly, 2 = all TabController _nestedTabController; + List lboards; @override void initState(){ @@ -75,27 +76,27 @@ class _OverviewView extends State with TickerProviderStateMixin{ } + //TODO: make future builder dependent + Widget leaderBoardWidget(LeaderboardType type) => FutureBuilder( - future: getLeaderboards(type), - builder: (BuildContext context, AsyncSnapshot> snapshot) { + future: getLeaderboard(type, "global"), //replace this once we have call to get all leaderboard names for user + builder: (BuildContext context, AsyncSnapshot snapshot) { + lboards = getLeaderboardNames(); if (snapshot.hasData) { return ListView.builder( - itemCount: snapshot.data.length, + itemCount: lboards.length, itemBuilder: (context, index) { return Card( child: ListTile( - title: Text("#" - + ((snapshot.data[index].entries.indexWhere((element) => element.user.name == "Peer") + 1).toString()) - + "/" - + (snapshot.data[index].entries.length).toString()), - leading: Text("World"), //TODO: API should let us retrieve a leaderboard name + //title: Text("#" + ((snapshot.data[index].entries.indexWhere((element) => element.user.name == "Peer") + 1).toString()) + "/"+ (snapshot.data[index].entries.length).toString()), + leading: Text(lboards[index].toString()), //TODO: API should let us retrieve a leaderboard name onTap: () { Navigator.push(context, MaterialPageRoute( builder: (context) => LeaderBoardView( - leaderboardIndex: index),)); + leaderBoardName: lboards[index], type: type,),)); }, ) ); @@ -103,13 +104,11 @@ class _OverviewView extends State with TickerProviderStateMixin{ ); } - else { - return SizedBox( - child: CircularProgressIndicator(), - width: 60, - height: 60, - ); - } + else if(snapshot.hasError) + return errorData(); + + else + return waitingLoop(); } ); } diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 5e314c3..95ff32d 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -58,14 +58,13 @@ class UserOverView extends StatelessWidget { ); } + else if(user.hasError) + return errorData(); + else{ return Container( padding: EdgeInsets.all(10.0), - child: SizedBox( - child: CircularProgressIndicator(), - width: 60, - height: 60) - ); + child: waitingLoop()); } } ); diff --git a/maptogether_api/example/maptogether_api_example.dart b/maptogether_api/example/maptogether_api_example.dart index 2790f37..2d49ca9 100644 --- a/maptogether_api/example/maptogether_api_example.dart +++ b/maptogether_api/example/maptogether_api_example.dart @@ -6,15 +6,19 @@ import '../lib/src/data.dart'; void main() { final api = MapTogetherApi(); - api.user(1).then(print); + /*api.user(1).then(print); api.globalLeaderboard(LeaderboardType.all_time).then(print); - + api.globalLeaderboard(LeaderboardType.all_time).then((l) { print(l.type); for(var t in l.entries) print(t.score); print("æøå ÆØÅ"); + });*/ + + api.leaderboard("global", LeaderboardType.all_time).then((l) { + print(l.entries[1].user.name); }); } From ef5846edb97142b5d2c06a9542e34bac8ab31f65 Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Wed, 19 May 2021 15:23:20 +0200 Subject: [PATCH 08/57] client: Refactored and formatted leaderboard screen --- .../social_menu_widgets/Leaderboard.dart | 99 ++++++++----------- 1 file changed, 40 insertions(+), 59 deletions(-) diff --git a/client/lib/widgets/social_menu_widgets/Leaderboard.dart b/client/lib/widgets/social_menu_widgets/Leaderboard.dart index 0a7bbed..c0f79a4 100644 --- a/client/lib/widgets/social_menu_widgets/Leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/Leaderboard.dart @@ -1,77 +1,58 @@ -import 'package:client/widgets/app_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:client/database.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'package:provider/provider.dart'; -import '../../data_fetchers.dart'; -import 'User.dart'; - +import 'package:client/database.dart'; +import 'package:client/widgets/app_bar.dart'; +import 'package:client/data_fetchers.dart'; +import 'package:client/widgets/social_menu_widgets/User.dart'; -class LeaderBoardView extends StatelessWidget{ +class LeaderBoardView extends StatelessWidget { int leaderboardIndex; String leaderBoardName; LeaderboardType type; - LeaderBoardView({Key key, @required this.leaderBoardName, @required this.type}) : super(key: key); + LeaderBoardView( + {Key key, @required this.leaderBoardName, @required this.type}) + : super(key: key); + + Widget scoreWidget(int placement, String name, int score) => Card( + child: ListTile( + title: Text("#$placement $name : $score"), + leading: CircleAvatar( + backgroundImage: AssetImage('assets/business.png'), + ), + ), + ); + + Widget leaderboard(Leaderboard leaderboard) => Scaffold( + appBar: MapTogetherAppBar( + title: "Leaderboard for " + leaderBoardName, + actions: [], + ), + body: Column(children: [ + Expanded( + child: ListView.builder( + itemCount: leaderboard.entries.length, + itemBuilder: (context, index) => scoreWidget( + index + 1, + leaderboard.entries[index].user.name, + leaderboard.entries[index].score)), + ), + ])); @override - Widget build(BuildContext context){ - + Widget build(BuildContext context) { return FutureBuilder( future: getLeaderboard(type, leaderBoardName), builder: (BuildContext context, AsyncSnapshot snapshot) { - if(snapshot.hasData) { - return Scaffold( - appBar: MapTogetherAppBar( - title: "Leaderboard for " + leaderBoardName, - actions: [], - ), - body: Center( - child: Container( - margin: EdgeInsets.all(40.0), - child: Column( - children: [ - Expanded( - child: ListView.builder( - itemCount: snapshot.data.entries.length, - itemBuilder: (context, index) { - return Card( - child: ListTile( - title: Text("#" - + (index + 1).toString() - + " " - + snapshot.data.entries[index].user.name - + " : " - + snapshot.data.entries[index].score.toString() - + " points"), - - leading: CircleAvatar( - backgroundImage: - AssetImage('assets/business.png'), - - ), - ), - ); - }), - ), - ] - ) - ) - ) - ); - } - else if(snapshot.hasError) + if (snapshot.hasData) + return leaderboard(snapshot.data); + else if (snapshot.hasError) return errorData(); - - else { - return Expanded( - flex: 14, - child: waitingLoop()); - } - } - ); - + else + return Expanded(flex: 14, child: waitingLoop()); + }); } } From 691c243574725be869269676746a456049a2877a Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Wed, 19 May 2021 15:47:37 +0200 Subject: [PATCH 09/57] client: Refactor and rename some widgets --- client/lib/database.dart | 2 +- client/lib/screens/page2.dart | 20 ------------------- .../{settings.dart => settings_screen.dart} | 0 .../pup_up_menu.dart | 2 +- .../{newFriend.dart => add_friend.dart} | 4 ++-- .../{newGroup.dart => create_group.dart} | 2 +- .../widgets/social_menu_widgets/friends.dart | 8 ++++---- .../widgets/social_menu_widgets/groups.dart | 4 ++-- .../{Leaderboard.dart => leaderboard.dart} | 2 +- .../widgets/social_menu_widgets/overview.dart | 4 ++-- .../{User.dart => user.dart} | 0 .../social_menu_widgets/user_overview.dart | 2 +- 12 files changed, 15 insertions(+), 35 deletions(-) delete mode 100644 client/lib/screens/page2.dart rename client/lib/screens/{settings.dart => settings_screen.dart} (100%) rename client/lib/widgets/social_menu_widgets/{newFriend.dart => add_friend.dart} (98%) rename client/lib/widgets/social_menu_widgets/{newGroup.dart => create_group.dart} (94%) rename client/lib/widgets/social_menu_widgets/{Leaderboard.dart => leaderboard.dart} (96%) rename client/lib/widgets/social_menu_widgets/{User.dart => user.dart} (100%) diff --git a/client/lib/database.dart b/client/lib/database.dart index 67ea7aa..bc08890 100644 --- a/client/lib/database.dart +++ b/client/lib/database.dart @@ -1,4 +1,4 @@ -import 'package:client/widgets/social_menu_widgets/User.dart'; +import 'package:client/widgets/social_menu_widgets/user.dart'; import 'package:flutter/foundation.dart'; //We get the current user through their username, usernames are unique, diff --git a/client/lib/screens/page2.dart b/client/lib/screens/page2.dart deleted file mode 100644 index d154127..0000000 --- a/client/lib/screens/page2.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:flutter/material.dart'; - -class Page2 extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Scaffold( - floatingActionButton: FloatingActionButton( - onPressed: (){ - Navigator.pop(context, true); - }, - ), - body: Container( - child: Center( - child: Text('Page 2', - style: TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold)), - ), - ), - ); - } -} \ No newline at end of file diff --git a/client/lib/screens/settings.dart b/client/lib/screens/settings_screen.dart similarity index 100% rename from client/lib/screens/settings.dart rename to client/lib/screens/settings_screen.dart diff --git a/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart b/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart index e864d10..07e80bc 100644 --- a/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart +++ b/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart @@ -1,5 +1,5 @@ import 'package:client/screens/new_activity_screen.dart'; -import 'package:client/screens/settings.dart'; +import 'package:client/screens/settings_screen.dart'; import 'package:client/screens/login_screen.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; diff --git a/client/lib/widgets/social_menu_widgets/newFriend.dart b/client/lib/widgets/social_menu_widgets/add_friend.dart similarity index 98% rename from client/lib/widgets/social_menu_widgets/newFriend.dart rename to client/lib/widgets/social_menu_widgets/add_friend.dart index 33ce418..9474e23 100644 --- a/client/lib/widgets/social_menu_widgets/newFriend.dart +++ b/client/lib/widgets/social_menu_widgets/add_friend.dart @@ -4,7 +4,7 @@ import 'friends.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; -class NewFriend extends StatelessWidget { +class AddFriend extends StatelessWidget { TextEditingController nameController = TextEditingController(); @override @@ -66,4 +66,4 @@ class NewFriend extends StatelessWidget { )) ); } -} \ No newline at end of file +} diff --git a/client/lib/widgets/social_menu_widgets/newGroup.dart b/client/lib/widgets/social_menu_widgets/create_group.dart similarity index 94% rename from client/lib/widgets/social_menu_widgets/newGroup.dart rename to client/lib/widgets/social_menu_widgets/create_group.dart index 0285916..6d35389 100644 --- a/client/lib/widgets/social_menu_widgets/newGroup.dart +++ b/client/lib/widgets/social_menu_widgets/create_group.dart @@ -1,7 +1,7 @@ import 'package:client/widgets/app_bar.dart'; import 'package:flutter/material.dart'; -class NewGroup extends StatelessWidget { +class CreateGroup extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 0859303..8c9a049 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -1,7 +1,7 @@ -import 'package:client/widgets/social_menu_widgets/Leaderboard.dart'; -import 'package:client/widgets/social_menu_widgets/newFriend.dart'; +import 'package:client/widgets/social_menu_widgets/leaderboard.dart'; +import 'package:client/widgets/social_menu_widgets/add_friend.dart'; import 'package:flutter/material.dart'; -import 'User.dart'; +import 'user.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; @@ -87,7 +87,7 @@ class Friends extends StatelessWidget { onPressed: () { Navigator.push(context, MaterialPageRoute( - builder: (context) => NewFriend())); + builder: (context) => AddFriend())); }, ), ), diff --git a/client/lib/widgets/social_menu_widgets/groups.dart b/client/lib/widgets/social_menu_widgets/groups.dart index d6553f6..342cd3a 100644 --- a/client/lib/widgets/social_menu_widgets/groups.dart +++ b/client/lib/widgets/social_menu_widgets/groups.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'newGroup.dart'; +import 'package:client/widgets/social_menu_widgets/create_group.dart'; class Groups extends StatelessWidget { @override @@ -25,7 +25,7 @@ class Groups extends StatelessWidget { ), onPressed: () { Navigator.push(context, - MaterialPageRoute(builder: (context) => NewGroup())); + MaterialPageRoute(builder: (context) => CreateGroup())); }, ), ), diff --git a/client/lib/widgets/social_menu_widgets/Leaderboard.dart b/client/lib/widgets/social_menu_widgets/leaderboard.dart similarity index 96% rename from client/lib/widgets/social_menu_widgets/Leaderboard.dart rename to client/lib/widgets/social_menu_widgets/leaderboard.dart index c0f79a4..7031fc3 100644 --- a/client/lib/widgets/social_menu_widgets/Leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/leaderboard.dart @@ -7,7 +7,7 @@ import 'package:provider/provider.dart'; import 'package:client/database.dart'; import 'package:client/widgets/app_bar.dart'; import 'package:client/data_fetchers.dart'; -import 'package:client/widgets/social_menu_widgets/User.dart'; +import 'package:client/widgets/social_menu_widgets/user.dart'; class LeaderBoardView extends StatelessWidget { int leaderboardIndex; diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index 2e4d027..c300f68 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -1,8 +1,8 @@ import 'package:client/widgets/social_menu_widgets/user_overview.dart'; import 'package:flutter/material.dart'; import 'package:maptogether_api/maptogether_api.dart'; -import 'Leaderboard.dart'; -import 'User.dart'; +import 'leaderboard.dart'; +import 'user.dart'; import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:client/data_fetchers.dart'; diff --git a/client/lib/widgets/social_menu_widgets/User.dart b/client/lib/widgets/social_menu_widgets/user.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/User.dart rename to client/lib/widgets/social_menu_widgets/user.dart diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 95ff32d..007fec7 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -2,7 +2,7 @@ import 'package:client/database.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'Leaderboard.dart'; +import 'leaderboard.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'package:client/data_fetchers.dart'; From 9ca897c4817027f90ce009ea9b5cf51dc94114f5 Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 15:52:52 +0200 Subject: [PATCH 10/57] add materialized views for leaderboards --- server/database/create-materialized-views.sql | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 server/database/create-materialized-views.sql diff --git a/server/database/create-materialized-views.sql b/server/database/create-materialized-views.sql new file mode 100644 index 0000000..ebfcbbd --- /dev/null +++ b/server/database/create-materialized-views.sql @@ -0,0 +1,37 @@ +CREATE MATERIALIZED VIEW leaderboardAllTime AS + SELECT u.userID, u.name, s.score + FROM ( + SELECT userID, SUM (score) AS score + FROM contributions + GROUP BY userID + ) AS s + RIGHT OUTER JOIN + users AS u + ON u.userID = s.userID + ORDER BY score DESC; + +CREATE MATERIALIZED VIEW leaderboardWeekly AS + SELECT u.userID, u.name, s.score + FROM ( + SELECT userID, SUM (score) AS score + FROM contributions + WHERE dateTime BETWEEN date_trunc('week', CURRENT_DATE) AND CURRENT_DATE + GROUP BY userID + ) AS s + RIGHT OUTER JOIN + users AS u + ON u.userID = s.userID + ORDER BY score DESC; + +CREATE MATERIALIZED VIEW leaderboardMonthly AS + SELECT u.userID, u.name, s.score + FROM ( + SELECT userID, SUM (score) AS score + FROM contributions + WHERE dateTime BETWEEN date_trunc('month', CURRENT_DATE) AND CURRENT_DATE + GROUP BY userID + ) AS s + RIGHT OUTER JOIN + users AS u + ON u.userID = s.userID + ORDER BY score DESC; From 32c7010e8a22c66033bec82c433143b6a0101eb7 Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 15:53:10 +0200 Subject: [PATCH 11/57] remove blank line --- server/database/create-tables.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/server/database/create-tables.sql b/server/database/create-tables.sql index 192bcad..c440bc0 100644 --- a/server/database/create-tables.sql +++ b/server/database/create-tables.sql @@ -18,7 +18,6 @@ CREATE TABLE IF NOT EXISTS contributions ( dateTime timestamptz ); - CREATE TABLE IF NOT EXISTS achievements ( achievementID BIGSERIAL PRIMARY KEY, name varchar, From 07aea1ab671bbbc08ea898ec2116b53ccb5b273f Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 15:53:51 +0200 Subject: [PATCH 12/57] Change contribution dates --- server/database/mock-contributions.sql | 1013 +++++++++++++++++++----- 1 file changed, 805 insertions(+), 208 deletions(-) diff --git a/server/database/mock-contributions.sql b/server/database/mock-contributions.sql index b80b4b2..4bd3936 100644 --- a/server/database/mock-contributions.sql +++ b/server/database/mock-contributions.sql @@ -9,212 +9,809 @@ VALUES INSERT INTO contributions (userID, type, changeSet, score, dateTime) VALUES - (1, 3, 7694, 3, '2020-01-20 7:19:38-00'), - (55, 3, 7138, 2, '2020-02-26 7:21:41-00'), - (21, 5, 6801, 5, '2020-02-02 21:31:48-00'), - (53, 2, 8936, 1, '2020-05-13 12:29:23-00'), - (3, 3, 3225, 5, '2020-03-04 4:14:00-00'), - (58, 2, 7094, 5, '2020-01-10 8:21:22-00'), - (43, 1, 2626, 2, '2020-05-16 13:17:33-00'), - (55, 4, 709, 5, '2020-01-09 12:09:11-00'), - (41, 5, 8461, 2, '2020-02-20 12:24:09-00'), - (7, 3, 9598, 4, '2020-03-19 23:46:18-00'), - (45, 1, 5139, 1, '2020-04-20 10:20:08-00'), - (52, 2, 1883, 4, '2020-01-07 21:32:40-00'), - (44, 3, 9438, 2, '2020-03-20 4:54:19-00'), - (54, 4, 3268, 4, '2020-03-02 19:58:58-00'), - (47, 2, 1827, 4, '2020-05-03 20:07:12-00'), - (29, 3, 4926, 5, '2020-02-14 0:45:42-00'), - (17, 5, 4596, 5, '2020-04-16 14:19:19-00'), - (35, 4, 5438, 2, '2020-01-09 23:48:07-00'), - (2, 3, 3190, 1, '2020-04-16 6:10:13-00'), - (42, 4, 9306, 4, '2020-02-10 13:47:35-00'), - (57, 4, 4702, 5, '2020-02-04 12:57:21-00'), - (4, 3, 4869, 4, '2020-03-24 18:05:20-00'), - (49, 4, 9495, 5, '2020-03-12 3:39:59-00'), - (18, 2, 4741, 3, '2020-04-17 12:15:19-00'), - (55, 4, 4652, 3, '2020-04-25 12:05:45-00'), - (17, 1, 4894, 1, '2020-04-14 18:04:11-00'), - (2, 4, 8288, 5, '2020-04-16 6:38:00-00'), - (47, 3, 1155, 2, '2020-02-23 12:17:45-00'), - (45, 1, 7071, 2, '2020-04-19 19:21:54-00'), - (54, 1, 3734, 3, '2020-05-18 14:10:13-00'), - (39, 1, 9160, 3, '2020-05-07 9:03:15-00'), - (5, 2, 2397, 2, '2020-02-09 18:45:23-00'), - (18, 2, 7164, 4, '2020-01-20 6:06:35-00'), - (26, 1, 211, 3, '2020-01-11 17:49:49-00'), - (30, 3, 9113, 4, '2020-05-09 19:00:21-00'), - (25, 4, 8282, 5, '2020-05-06 0:10:43-00'), - (45, 2, 3144, 1, '2020-04-04 14:00:36-00'), - (29, 4, 1099, 3, '2020-03-20 5:39:41-00'), - (57, 4, 5818, 1, '2020-04-28 4:13:52-00'), - (23, 4, 2497, 5, '2020-05-17 10:39:31-00'), - (21, 4, 6776, 2, '2020-05-10 11:44:50-00'), - (57, 5, 2563, 3, '2020-01-15 6:16:30-00'), - (43, 4, 387, 2, '2020-01-18 22:56:15-00'), - (40, 4, 2620, 3, '2020-03-09 3:05:25-00'), - (43, 3, 6440, 2, '2020-04-08 10:49:36-00'), - (23, 3, 1153, 5, '2020-05-16 11:38:30-00'), - (20, 3, 3877, 3, '2020-03-11 2:10:18-00'), - (35, 4, 5620, 4, '2020-02-12 12:12:18-00'), - (49, 1, 5121, 5, '2020-02-10 21:39:15-00'), - (57, 2, 5592, 5, '2020-04-12 1:54:18-00'), - (19, 2, 5623, 3, '2020-04-23 22:54:47-00'), - (36, 3, 7354, 4, '2020-02-11 13:28:57-00'), - (34, 1, 3191, 5, '2020-05-15 9:16:23-00'), - (10, 1, 6109, 1, '2020-05-12 0:02:11-00'), - (54, 3, 899, 5, '2020-01-12 3:18:23-00'), - (14, 2, 750, 1, '2020-02-18 11:50:53-00'), - (23, 1, 8249, 2, '2020-01-20 8:40:05-00'), - (13, 1, 3395, 1, '2020-02-14 8:40:44-00'), - (56, 5, 7726, 2, '2020-04-13 0:30:06-00'), - (34, 2, 599, 4, '2020-02-21 0:12:06-00'), - (2, 2, 4985, 5, '2020-03-15 20:08:30-00'), - (53, 1, 8618, 3, '2020-01-08 11:49:09-00'), - (59, 3, 6282, 1, '2020-05-11 2:28:48-00'), - (58, 2, 760, 3, '2020-01-23 9:56:33-00'), - (46, 4, 9767, 3, '2020-04-05 6:08:20-00'), - (41, 1, 2133, 1, '2020-01-26 6:18:39-00'), - (51, 1, 5818, 2, '2020-04-09 0:07:59-00'), - (9, 2, 698, 2, '2020-03-03 7:33:27-00'), - (6, 4, 6259, 1, '2020-03-24 21:47:17-00'), - (42, 1, 9588, 3, '2020-02-08 1:06:47-00'), - (42, 2, 3947, 4, '2020-02-09 21:57:57-00'), - (43, 1, 7756, 2, '2020-01-09 0:07:14-00'), - (38, 1, 8281, 2, '2020-05-07 3:38:08-00'), - (14, 1, 7772, 1, '2020-05-03 17:23:48-00'), - (44, 3, 3548, 4, '2020-03-27 16:26:11-00'), - (60, 2, 7400, 4, '2020-05-11 8:52:46-00'), - (30, 3, 9395, 2, '2020-02-10 19:05:21-00'), - (18, 1, 1206, 4, '2020-03-28 17:25:14-00'), - (36, 2, 776, 2, '2020-04-14 2:44:42-00'), - (48, 2, 4050, 2, '2020-04-05 15:30:16-00'), - (30, 1, 6801, 1, '2020-03-26 5:45:27-00'), - (41, 2, 7342, 5, '2020-04-09 22:40:18-00'), - (26, 3, 1967, 3, '2020-02-20 14:39:49-00'), - (31, 4, 4738, 1, '2020-03-08 13:13:27-00'), - (8, 3, 783, 1, '2020-02-24 2:30:28-00'), - (11, 5, 1521, 4, '2020-05-22 11:37:10-00'), - (35, 3, 5740, 3, '2020-01-23 19:32:37-00'), - (13, 3, 3832, 2, '2020-05-18 7:23:31-00'), - (58, 4, 2139, 1, '2020-05-19 1:41:00-00'), - (17, 3, 6671, 5, '2020-01-13 11:04:18-00'), - (42, 1, 5103, 5, '2020-05-23 17:08:48-00'), - (45, 2, 1399, 1, '2020-01-24 18:31:01-00'), - (49, 2, 3657, 5, '2020-04-05 5:54:05-00'), - (42, 1, 9915, 4, '2020-01-20 8:42:16-00'), - (16, 4, 1024, 5, '2020-02-03 9:59:27-00'), - (19, 3, 9621, 4, '2020-02-25 11:01:02-00'), - (11, 2, 30, 5, '2020-05-08 12:51:31-00'), - (16, 1, 285, 5, '2020-05-10 18:38:55-00'), - (54, 5, 275, 4, '2020-04-14 10:38:04-00'), - (32, 5, 444, 3, '2020-04-25 18:33:33-00'), - (43, 4, 9009, 1, '2020-02-22 21:23:36-00'), - (42, 2, 8063, 3, '2020-04-28 16:20:01-00'), - (50, 1, 9653, 5, '2020-02-12 17:26:31-00'), - (1, 2, 7658, 5, '2020-02-13 2:49:18-00'), - (22, 1, 6310, 1, '2020-04-13 18:27:45-00'), - (32, 5, 2488, 5, '2020-05-19 3:06:05-00'), - (28, 4, 1831, 4, '2020-01-09 1:24:43-00'), - (33, 3, 4875, 4, '2020-03-02 0:30:54-00'), - (26, 3, 2503, 2, '2020-04-25 7:49:57-00'), - (13, 4, 9001, 2, '2020-03-28 1:26:59-00'), - (45, 4, 5136, 5, '2020-04-14 2:06:52-00'), - (42, 3, 3695, 2, '2020-01-14 8:14:16-00'), - (26, 3, 9433, 1, '2020-05-12 3:24:10-00'), - (37, 2, 6452, 1, '2020-01-06 16:51:09-00'), - (46, 2, 1906, 4, '2020-03-03 3:15:48-00'), - (58, 4, 5776, 2, '2020-04-18 23:30:35-00'), - (44, 3, 7150, 1, '2020-05-23 6:10:16-00'), - (29, 1, 8347, 5, '2020-01-20 7:47:04-00'), - (51, 1, 3973, 4, '2020-03-11 23:52:21-00'), - (6, 3, 430, 3, '2020-05-18 12:57:42-00'), - (51, 5, 3003, 3, '2020-02-18 11:47:33-00'), - (7, 3, 9496, 2, '2020-02-04 0:36:34-00'), - (9, 2, 9427, 2, '2020-04-12 1:41:53-00'), - (32, 3, 2707, 3, '2020-03-01 7:20:46-00'), - (42, 5, 2927, 2, '2020-04-10 19:21:37-00'), - (15, 5, 5026, 2, '2020-01-21 18:09:18-00'), - (48, 3, 194, 5, '2020-04-09 16:29:52-00'), - (41, 2, 2190, 3, '2020-03-25 14:08:44-00'), - (46, 1, 680, 3, '2020-05-10 21:31:14-00'), - (26, 5, 8908, 5, '2020-03-19 8:55:53-00'), - (60, 1, 1403, 4, '2020-03-21 20:08:28-00'), - (42, 5, 4877, 1, '2020-03-23 17:43:31-00'), - (36, 2, 6969, 3, '2020-01-18 0:08:12-00'), - (4, 5, 2228, 4, '2020-03-06 20:24:17-00'), - (18, 3, 5280, 2, '2020-05-17 7:02:59-00'), - (12, 4, 5766, 5, '2020-02-23 18:13:41-00'), - (28, 4, 2229, 1, '2020-02-14 4:16:41-00'), - (20, 2, 1929, 3, '2020-02-07 19:53:15-00'), - (48, 3, 1602, 2, '2020-04-10 2:28:58-00'), - (57, 5, 6545, 5, '2020-04-13 21:11:13-00'), - (4, 3, 6265, 2, '2020-01-07 6:37:22-00'), - (42, 1, 9321, 4, '2020-05-04 20:20:57-00'), - (57, 4, 6603, 4, '2020-01-16 9:35:46-00'), - (33, 2, 3092, 3, '2020-01-16 12:06:03-00'), - (57, 1, 8756, 2, '2020-02-13 0:30:05-00'), - (1, 3, 485, 5, '2020-04-27 13:04:14-00'), - (1, 2, 868, 4, '2020-02-22 10:26:04-00'), - (24, 2, 1873, 2, '2020-04-23 7:48:05-00'), - (12, 5, 9043, 3, '2020-04-21 12:18:34-00'), - (60, 1, 645, 2, '2020-03-05 7:36:45-00'), - (52, 1, 29, 3, '2020-05-18 1:51:04-00'), - (27, 2, 5092, 3, '2020-03-24 11:54:01-00'), - (12, 3, 1691, 1, '2020-01-06 2:37:51-00'), - (14, 5, 9774, 4, '2020-02-04 12:54:20-00'), - (56, 2, 3780, 4, '2020-02-24 18:31:22-00'), - (2, 5, 9210, 5, '2020-03-04 19:17:47-00'), - (52, 1, 7196, 1, '2020-02-01 8:49:52-00'), - (42, 2, 3783, 2, '2020-05-01 13:38:23-00'), - (4, 5, 6533, 2, '2020-03-22 7:26:09-00'), - (49, 1, 702, 1, '2020-03-05 5:43:54-00'), - (29, 3, 6431, 3, '2020-02-08 0:35:13-00'), - (9, 3, 4198, 4, '2020-03-13 3:24:15-00'), - (42, 4, 6331, 5, '2020-04-01 15:35:51-00'), - (22, 5, 6449, 4, '2020-05-11 12:15:26-00'), - (6, 2, 7530, 1, '2020-01-10 7:54:57-00'), - (27, 2, 2412, 2, '2020-01-21 14:51:56-00'), - (9, 1, 8170, 1, '2020-02-01 14:08:04-00'), - (8, 1, 2376, 5, '2020-01-24 14:45:05-00'), - (16, 2, 1777, 5, '2020-05-05 17:10:33-00'), - (9, 2, 4771, 1, '2020-05-06 13:52:11-00'), - (28, 1, 3692, 5, '2020-01-05 6:26:52-00'), - (1, 3, 5811, 3, '2020-02-23 1:58:50-00'), - (35, 5, 6293, 3, '2020-01-04 4:45:58-00'), - (1, 5, 228, 3, '2020-05-18 14:06:00-00'), - (45, 5, 6700, 3, '2020-04-18 13:15:42-00'), - (14, 2, 9158, 5, '2020-03-13 9:08:05-00'), - (8, 1, 3972, 5, '2020-03-17 13:42:13-00'), - (57, 3, 6115, 4, '2020-03-14 21:03:36-00'), - (59, 1, 1611, 4, '2020-01-20 18:01:44-00'), - (52, 5, 7500, 1, '2020-05-15 8:52:48-00'), - (15, 5, 5440, 4, '2020-01-10 7:36:41-00'), - (40, 4, 8761, 5, '2020-02-13 13:28:27-00'), - (23, 2, 7771, 3, '2020-05-09 9:47:50-00'), - (49, 1, 7017, 1, '2020-04-24 12:31:23-00'), - (37, 1, 9929, 1, '2020-01-10 0:20:55-00'), - (17, 4, 3705, 5, '2020-01-13 2:19:54-00'), - (35, 3, 2198, 1, '2020-05-02 21:25:29-00'), - (60, 1, 8597, 3, '2020-03-19 15:46:48-00'), - (41, 4, 447, 2, '2020-03-14 5:56:38-00'), - (16, 4, 133, 1, '2020-05-13 9:41:39-00'), - (34, 2, 9823, 1, '2020-03-02 0:16:21-00'), - (9, 3, 2131, 5, '2020-05-18 16:11:49-00'), - (33, 3, 3817, 4, '2020-03-21 18:05:34-00'), - (3, 3, 8714, 4, '2020-02-03 21:53:45-00'), - (30, 2, 7509, 3, '2020-02-11 8:25:47-00'), - (41, 4, 8785, 2, '2020-01-04 8:41:31-00'), - (42, 4, 8343, 2, '2020-01-02 17:12:02-00'), - (3, 5, 7361, 4, '2020-01-27 22:59:03-00'), - (27, 4, 6896, 4, '2020-01-12 23:05:38-00'), - (29, 2, 6141, 4, '2020-02-21 19:47:44-00'), - (37, 5, 7805, 3, '2020-02-24 9:04:29-00'), - (23, 2, 1063, 4, '2020-01-28 6:04:30-00'), - (59, 4, 8386, 4, '2020-02-08 7:42:31-00'), - (4, 2, 4464, 4, '2020-05-07 1:15:14-00'), - (55, 5, 4173, 3, '2020-01-23 4:18:23-00'), - (26, 2, 5732, 1, '2020-03-12 17:16:37-00'), - (16, 1, 6498, 3, '2020-05-05 20:39:00-00'), - (33, 3, 9968, 5, '2020-03-01 4:20:10-00') + (22, 3, 6978, 2, '2021-06-18 3:57:46-00'), + (57, 3, 2746, 5, '2021-05-18 4:20:17-00'), + (9, 2, 8875, 3, '2021-05-14 11:28:46-00'), + (46, 2, 4426, 5, '2021-04-10 4:38:05-00'), + (35, 1, 1433, 3, '2021-04-14 9:26:13-00'), + (17, 5, 489, 3, '2021-05-22 14:00:12-00'), + (27, 4, 3648, 2, '2021-06-27 19:14:47-00'), + (20, 3, 1325, 2, '2021-04-16 1:22:36-00'), + (11, 3, 7846, 2, '2021-04-05 12:41:59-00'), + (52, 3, 2743, 5, '2021-05-15 8:53:53-00'), + (13, 2, 1953, 2, '2021-05-21 1:51:26-00'), + (11, 3, 7030, 3, '2021-05-23 6:23:44-00'), + (34, 5, 1438, 4, '2021-05-16 9:13:25-00'), + (36, 2, 222, 5, '2021-05-02 17:19:21-00'), + (43, 5, 3641, 3, '2021-06-03 19:57:51-00'), + (7, 4, 5659, 5, '2021-06-01 14:31:01-00'), + (55, 1, 2601, 1, '2021-06-18 5:56:16-00'), + (52, 1, 9221, 5, '2021-04-07 23:40:05-00'), + (60, 1, 3893, 5, '2021-06-26 15:51:27-00'), + (55, 4, 7390, 2, '2021-06-20 4:38:36-00'), + (13, 1, 8817, 4, '2021-05-17 9:47:25-00'), + (36, 2, 4928, 2, '2021-04-28 12:55:22-00'), + (13, 3, 3423, 5, '2021-05-20 23:29:47-00'), + (33, 2, 6523, 5, '2021-05-16 5:43:22-00'), + (54, 1, 1697, 3, '2021-06-01 2:15:08-00'), + (18, 5, 5076, 1, '2021-05-04 21:40:15-00'), + (2, 3, 7561, 2, '2021-06-06 5:30:23-00'), + (49, 5, 7110, 3, '2021-04-26 14:47:09-00'), + (20, 4, 1812, 1, '2021-05-09 2:01:15-00'), + (9, 4, 4165, 5, '2021-04-21 6:18:47-00'), + (27, 4, 3425, 2, '2021-04-24 9:21:01-00'), + (42, 5, 9820, 1, '2021-06-23 11:06:05-00'), + (32, 1, 3022, 3, '2021-04-20 23:57:53-00'), + (7, 5, 9869, 3, '2021-06-07 19:24:36-00'), + (38, 5, 8327, 4, '2021-04-02 10:42:46-00'), + (46, 3, 78, 3, '2021-04-13 18:47:57-00'), + (5, 4, 5875, 5, '2021-05-28 12:56:37-00'), + (7, 2, 3376, 1, '2021-06-26 5:10:15-00'), + (31, 2, 2773, 2, '2021-06-20 16:03:26-00'), + (16, 2, 1880, 1, '2021-05-06 19:32:48-00'), + (48, 4, 36, 4, '2021-05-18 23:28:46-00'), + (46, 2, 9007, 5, '2021-06-01 1:03:40-00'), + (52, 2, 7238, 4, '2021-04-23 12:11:54-00'), + (10, 5, 7464, 2, '2021-04-12 15:01:27-00'), + (48, 3, 2508, 1, '2021-04-21 8:12:29-00'), + (21, 1, 3414, 2, '2021-05-07 13:54:01-00'), + (27, 3, 6932, 1, '2021-05-10 18:16:57-00'), + (13, 2, 4990, 1, '2021-05-01 18:42:41-00'), + (1, 1, 5527, 1, '2021-04-07 16:23:00-00'), + (47, 2, 3132, 5, '2021-06-03 9:52:36-00'), + (44, 3, 6051, 3, '2021-04-27 20:54:46-00'), + (52, 5, 874, 5, '2021-06-02 4:16:09-00'), + (12, 5, 3289, 4, '2021-05-13 20:58:55-00'), + (56, 3, 8049, 1, '2021-06-10 14:19:11-00'), + (40, 5, 6859, 1, '2021-06-16 18:46:28-00'), + (8, 2, 2926, 2, '2021-05-23 21:06:53-00'), + (5, 1, 9937, 5, '2021-06-03 13:26:45-00'), + (20, 1, 8676, 1, '2021-05-26 10:02:14-00'), + (24, 4, 1995, 4, '2021-06-27 17:51:40-00'), + (60, 2, 8265, 1, '2021-06-25 14:54:08-00'), + (14, 4, 9572, 1, '2021-05-18 20:04:04-00'), + (5, 3, 9452, 2, '2021-06-06 18:23:52-00'), + (25, 5, 3875, 1, '2021-06-20 1:43:40-00'), + (28, 4, 3615, 1, '2021-05-23 18:38:17-00'), + (51, 3, 5874, 1, '2021-05-06 21:47:26-00'), + (35, 3, 5707, 1, '2021-05-04 15:50:49-00'), + (43, 3, 146, 5, '2021-06-03 18:14:15-00'), + (30, 2, 40, 1, '2021-04-19 22:05:34-00'), + (19, 3, 2151, 5, '2021-05-22 15:22:47-00'), + (26, 3, 6838, 5, '2021-05-03 23:43:41-00'), + (40, 4, 3445, 2, '2021-05-25 22:30:29-00'), + (18, 1, 5274, 2, '2021-06-26 16:02:12-00'), + (52, 1, 1261, 3, '2021-04-07 11:21:30-00'), + (29, 5, 9951, 4, '2021-05-06 12:31:31-00'), + (29, 1, 7953, 1, '2021-06-21 4:31:35-00'), + (60, 2, 1901, 1, '2021-05-25 22:41:00-00'), + (27, 4, 576, 4, '2021-04-13 6:11:22-00'), + (59, 4, 4769, 1, '2021-04-07 22:26:25-00'), + (35, 4, 3067, 3, '2021-04-13 14:56:06-00'), + (7, 1, 7103, 4, '2021-06-27 16:16:04-00'), + (3, 5, 8324, 5, '2021-05-07 23:48:16-00'), + (43, 2, 3654, 1, '2021-05-23 13:47:46-00'), + (45, 1, 5026, 3, '2021-06-04 17:07:50-00'), + (16, 1, 762, 1, '2021-05-19 8:58:21-00'), + (4, 5, 5997, 1, '2021-05-25 15:43:43-00'), + (53, 1, 3972, 2, '2021-04-04 10:13:48-00'), + (12, 4, 256, 5, '2021-05-02 4:40:15-00'), + (11, 2, 8497, 3, '2021-04-16 20:18:51-00'), + (11, 3, 3928, 2, '2021-06-11 10:58:38-00'), + (33, 2, 577, 3, '2021-06-08 10:27:04-00'), + (5, 4, 6751, 5, '2021-06-17 16:58:28-00'), + (17, 5, 3707, 5, '2021-05-25 7:48:13-00'), + (20, 3, 5978, 3, '2021-06-11 1:56:13-00'), + (12, 2, 2739, 3, '2021-05-24 0:11:36-00'), + (14, 4, 5016, 5, '2021-06-15 19:31:37-00'), + (24, 3, 776, 2, '2021-06-20 19:59:55-00'), + (38, 2, 1235, 5, '2021-06-23 16:41:50-00'), + (10, 2, 685, 3, '2021-06-05 15:28:07-00'), + (43, 1, 1430, 3, '2021-05-13 1:42:41-00'), + (22, 5, 7976, 1, '2021-04-16 21:28:23-00'), + (60, 4, 2919, 5, '2021-04-15 0:34:13-00'), + (60, 2, 4829, 1, '2021-06-04 1:37:29-00'), + (45, 4, 3390, 1, '2021-06-15 14:05:23-00'), + (40, 2, 9425, 2, '2021-05-23 21:36:37-00'), + (14, 2, 280, 4, '2021-06-28 5:17:28-00'), + (31, 4, 3497, 1, '2021-06-21 16:14:57-00'), + (31, 5, 9952, 3, '2021-04-20 17:59:09-00'), + (14, 4, 8979, 1, '2021-06-16 23:30:06-00'), + (37, 2, 1533, 2, '2021-05-18 21:07:01-00'), + (44, 5, 4084, 2, '2021-04-19 5:50:06-00'), + (55, 4, 7439, 1, '2021-05-18 20:28:58-00'), + (15, 3, 5841, 3, '2021-06-02 8:56:30-00'), + (11, 4, 7914, 5, '2021-06-14 0:02:14-00'), + (6, 1, 3424, 3, '2021-05-12 14:20:28-00'), + (6, 1, 3437, 5, '2021-04-17 0:19:45-00'), + (56, 2, 4526, 2, '2021-06-06 12:36:23-00'), + (2, 2, 8664, 2, '2021-06-06 5:54:55-00'), + (60, 3, 7192, 2, '2021-06-11 10:07:56-00'), + (40, 1, 8839, 4, '2021-05-02 7:39:30-00'), + (43, 4, 9170, 2, '2021-06-17 2:52:06-00'), + (12, 1, 8691, 3, '2021-06-15 12:19:34-00'), + (2, 5, 6170, 5, '2021-05-05 19:10:28-00'), + (58, 1, 4753, 1, '2021-05-02 12:44:34-00'), + (48, 5, 4756, 4, '2021-04-14 9:02:28-00'), + (41, 2, 388, 4, '2021-06-21 20:44:10-00'), + (55, 4, 2054, 4, '2021-05-26 5:31:54-00'), + (44, 3, 5162, 4, '2021-05-05 19:01:59-00'), + (2, 2, 7766, 1, '2021-06-13 3:35:38-00'), + (48, 2, 2223, 5, '2021-06-02 5:27:09-00'), + (57, 3, 4976, 2, '2021-06-24 21:22:25-00'), + (53, 1, 2066, 5, '2021-05-19 0:03:13-00'), + (29, 4, 8018, 1, '2021-05-16 6:50:23-00'), + (27, 5, 334, 5, '2021-04-15 17:32:22-00'), + (8, 1, 1547, 2, '2021-05-23 0:46:09-00'), + (8, 1, 5530, 3, '2021-06-23 14:12:36-00'), + (32, 4, 9070, 4, '2021-05-16 8:59:00-00'), + (29, 4, 2869, 1, '2021-04-27 6:45:52-00'), + (2, 3, 3889, 5, '2021-04-26 12:30:40-00'), + (47, 1, 4277, 2, '2021-05-20 3:54:57-00'), + (54, 1, 5720, 3, '2021-04-05 21:46:28-00'), + (43, 3, 4432, 1, '2021-06-03 23:28:45-00'), + (43, 3, 8411, 1, '2021-04-15 7:19:07-00'), + (13, 5, 3348, 1, '2021-05-22 2:39:30-00'), + (53, 5, 5231, 1, '2021-06-25 3:18:01-00'), + (17, 4, 1869, 2, '2021-06-28 5:31:52-00'), + (12, 5, 2271, 1, '2021-04-25 15:30:19-00'), + (3, 2, 1772, 2, '2021-04-07 2:26:33-00'), + (24, 1, 1171, 1, '2021-05-07 4:36:31-00'), + (11, 3, 4294, 1, '2021-05-14 12:20:02-00'), + (11, 3, 1096, 2, '2021-04-27 15:41:28-00'), + (47, 3, 8114, 1, '2021-06-17 9:48:26-00'), + (28, 3, 2367, 5, '2021-05-21 16:22:05-00'), + (44, 2, 2956, 5, '2021-06-06 3:17:32-00'), + (13, 5, 9824, 1, '2021-04-24 15:05:54-00'), + (49, 5, 3445, 2, '2021-04-04 14:31:14-00'), + (2, 3, 4119, 4, '2021-05-26 4:08:26-00'), + (34, 4, 1649, 2, '2021-06-11 4:21:11-00'), + (26, 3, 4181, 4, '2021-06-28 11:32:16-00'), + (57, 2, 5884, 5, '2021-06-23 0:37:25-00'), + (1, 4, 9951, 1, '2021-06-09 7:15:41-00'), + (26, 2, 6914, 4, '2021-06-27 19:59:46-00'), + (1, 4, 1427, 3, '2021-05-24 18:57:59-00'), + (28, 2, 3824, 4, '2021-05-12 3:28:04-00'), + (31, 5, 7153, 5, '2021-05-23 11:41:51-00'), + (8, 2, 9413, 2, '2021-06-12 2:05:22-00'), + (29, 2, 5242, 3, '2021-05-07 16:23:31-00'), + (59, 3, 6199, 4, '2021-05-04 13:59:23-00'), + (60, 1, 5038, 5, '2021-04-23 3:49:05-00'), + (54, 2, 2130, 5, '2021-06-25 1:04:33-00'), + (52, 5, 4368, 1, '2021-04-08 7:52:52-00'), + (29, 3, 7135, 4, '2021-04-28 0:14:37-00'), + (53, 2, 981, 2, '2021-06-12 2:01:39-00'), + (14, 3, 6391, 2, '2021-06-20 18:37:44-00'), + (49, 3, 8721, 2, '2021-06-07 13:43:17-00'), + (9, 3, 4701, 4, '2021-06-02 16:06:12-00'), + (9, 2, 2666, 1, '2021-05-04 22:19:58-00'), + (37, 1, 7612, 2, '2021-04-20 12:42:46-00'), + (46, 2, 2163, 4, '2021-05-05 9:12:15-00'), + (45, 1, 998, 2, '2021-06-19 17:30:03-00'), + (19, 1, 8030, 2, '2021-04-19 23:37:49-00'), + (32, 1, 9616, 5, '2021-04-23 9:15:23-00'), + (16, 1, 555, 4, '2021-05-14 5:51:18-00'), + (1, 2, 1353, 3, '2021-06-09 21:08:44-00'), + (8, 5, 2332, 1, '2021-05-05 22:40:46-00'), + (22, 2, 251, 5, '2021-06-28 23:04:55-00'), + (11, 1, 2451, 1, '2021-05-04 1:30:19-00'), + (47, 1, 4668, 1, '2021-05-25 10:30:24-00'), + (42, 1, 3596, 1, '2021-04-10 7:39:36-00'), + (33, 4, 6285, 2, '2021-06-02 14:58:25-00'), + (37, 2, 3003, 1, '2021-05-04 23:50:28-00'), + (54, 3, 4140, 2, '2021-04-13 22:30:27-00'), + (32, 4, 1349, 3, '2021-06-15 17:17:54-00'), + (23, 1, 1108, 5, '2021-05-16 1:39:10-00'), + (44, 2, 2068, 1, '2021-06-16 21:45:25-00'), + (26, 2, 5768, 3, '2021-06-03 3:22:18-00'), + (1, 1, 6888, 2, '2021-05-05 2:13:53-00'), + (10, 4, 3619, 5, '2021-04-28 1:25:11-00'), + (57, 3, 2061, 5, '2021-04-06 9:38:04-00'), + (58, 3, 9280, 3, '2021-04-23 8:27:59-00'), + (22, 4, 208, 1, '2021-05-17 14:31:25-00'), + (17, 3, 4728, 5, '2021-05-28 20:50:37-00'), + (10, 5, 4128, 3, '2021-06-06 19:11:51-00'), + (11, 5, 8999, 5, '2021-05-25 8:14:00-00'), + (1, 4, 4836, 3, '2021-04-12 11:34:20-00'), + (12, 3, 6988, 3, '2021-04-19 11:02:23-00'), + (32, 1, 3935, 2, '2021-04-22 16:03:24-00'), + (33, 1, 9282, 5, '2021-04-24 5:18:14-00'), + (1, 4, 4113, 4, '2021-06-23 10:22:30-00'), + (22, 2, 9612, 3, '2021-04-07 20:40:01-00'), + (1, 1, 1078, 2, '2021-04-13 9:44:13-00'), + (24, 5, 8465, 3, '2021-04-02 16:21:02-00'), + (50, 4, 7517, 5, '2021-04-02 13:40:16-00'), + (12, 2, 4913, 5, '2021-06-26 2:17:35-00'), + (22, 1, 9313, 3, '2021-06-01 4:35:06-00'), + (8, 2, 8335, 1, '2021-05-16 22:04:20-00'), + (56, 5, 3023, 1, '2021-06-20 13:02:56-00'), + (16, 3, 9214, 5, '2021-05-05 11:38:56-00'), + (53, 3, 4789, 3, '2021-04-13 14:39:07-00'), + (55, 3, 4990, 5, '2021-06-01 5:22:33-00'), + (36, 4, 3226, 1, '2021-04-18 4:33:02-00'), + (9, 4, 8745, 4, '2021-06-11 4:10:12-00'), + (21, 4, 306, 4, '2021-06-07 16:47:57-00'), + (9, 3, 7420, 1, '2021-06-15 13:31:36-00'), + (37, 2, 5983, 2, '2021-05-25 15:58:39-00'), + (45, 5, 9662, 1, '2021-05-03 23:06:20-00'), + (36, 4, 1645, 3, '2021-04-19 7:43:42-00'), + (22, 4, 4498, 4, '2021-04-02 10:18:23-00'), + (44, 3, 6337, 4, '2021-05-21 23:32:30-00'), + (1, 2, 4554, 1, '2021-05-21 3:02:19-00'), + (52, 4, 1310, 2, '2021-04-22 5:20:49-00'), + (14, 5, 4350, 5, '2021-04-02 21:43:08-00'), + (39, 4, 5554, 2, '2021-04-06 0:43:14-00'), + (59, 4, 5161, 1, '2021-05-16 12:15:21-00'), + (48, 5, 4389, 1, '2021-05-06 18:15:41-00'), + (13, 1, 2696, 1, '2021-06-26 19:32:13-00'), + (31, 3, 5121, 2, '2021-04-09 17:39:08-00'), + (51, 3, 1174, 3, '2021-06-07 4:27:20-00'), + (51, 2, 393, 2, '2021-04-20 20:56:42-00'), + (19, 4, 9080, 5, '2021-04-06 2:21:28-00'), + (47, 3, 5153, 3, '2021-06-08 13:11:41-00'), + (3, 3, 6563, 2, '2021-05-07 15:02:14-00'), + (48, 1, 3341, 3, '2021-04-27 10:58:23-00'), + (45, 2, 4507, 2, '2021-06-04 11:52:48-00'), + (54, 1, 8971, 5, '2021-05-09 8:00:37-00'), + (37, 3, 2579, 4, '2021-06-23 23:15:41-00'), + (12, 4, 2667, 3, '2021-05-28 18:29:46-00'), + (14, 1, 990, 4, '2021-05-27 0:04:40-00'), + (37, 2, 8901, 2, '2021-05-17 2:53:17-00'), + (14, 2, 1898, 1, '2021-06-11 4:37:06-00'), + (7, 4, 6811, 5, '2021-04-10 15:42:18-00'), + (27, 2, 1710, 3, '2021-04-14 22:40:00-00'), + (20, 2, 3543, 5, '2021-04-17 5:40:39-00'), + (18, 2, 5072, 4, '2021-04-13 6:26:56-00'), + (51, 5, 9301, 3, '2021-04-18 15:33:29-00'), + (51, 1, 8057, 4, '2021-05-15 10:57:02-00'), + (41, 1, 8003, 4, '2021-04-08 14:24:15-00'), + (30, 2, 9793, 1, '2021-06-24 13:55:18-00'), + (42, 1, 3075, 5, '2021-04-05 9:41:20-00'), + (14, 5, 6417, 2, '2021-06-18 0:26:07-00'), + (23, 3, 2538, 4, '2021-04-07 6:46:10-00'), + (37, 4, 2209, 5, '2021-06-20 8:52:30-00'), + (16, 1, 4950, 4, '2021-05-02 21:57:55-00'), + (58, 1, 2206, 4, '2021-05-20 2:12:42-00'), + (5, 4, 2733, 5, '2021-04-19 21:05:38-00'), + (24, 5, 307, 1, '2021-04-20 9:20:42-00'), + (14, 3, 9369, 3, '2021-05-24 9:04:02-00'), + (51, 3, 9197, 2, '2021-05-12 8:28:51-00'), + (29, 3, 8400, 2, '2021-05-19 0:07:07-00'), + (42, 4, 3007, 2, '2021-06-23 18:30:50-00'), + (11, 1, 866, 4, '2021-05-17 23:06:39-00'), + (49, 1, 5972, 2, '2021-05-04 1:59:27-00'), + (26, 2, 8795, 2, '2021-04-22 16:03:05-00'), + (35, 2, 5960, 5, '2021-05-13 1:37:12-00'), + (56, 2, 5434, 1, '2021-06-10 11:38:19-00'), + (2, 2, 6320, 1, '2021-04-13 12:03:46-00'), + (39, 4, 5426, 2, '2021-04-09 5:09:44-00'), + (7, 5, 9780, 3, '2021-06-01 12:47:11-00'), + (57, 4, 7864, 4, '2021-05-15 10:47:01-00'), + (55, 1, 4944, 3, '2021-06-04 21:05:55-00'), + (56, 5, 7503, 1, '2021-05-28 22:20:41-00'), + (1, 5, 859, 5, '2021-05-03 4:29:17-00'), + (33, 4, 3938, 4, '2021-04-13 23:43:03-00'), + (13, 1, 3074, 4, '2021-05-05 12:43:18-00'), + (57, 1, 5090, 1, '2021-06-26 8:14:57-00'), + (12, 1, 7360, 3, '2021-05-21 17:49:53-00'), + (41, 1, 8520, 1, '2021-04-02 15:36:18-00'), + (34, 5, 503, 1, '2021-05-15 22:41:46-00'), + (35, 4, 1142, 5, '2021-06-09 5:11:24-00'), + (56, 2, 8246, 2, '2021-05-04 10:03:33-00'), + (37, 3, 1304, 3, '2021-05-10 12:42:55-00'), + (30, 5, 7409, 5, '2021-04-17 18:47:14-00'), + (33, 3, 2760, 5, '2021-06-19 21:47:29-00'), + (29, 3, 1881, 1, '2021-04-10 16:47:50-00'), + (60, 2, 7002, 4, '2021-04-27 9:41:55-00'), + (8, 1, 5888, 5, '2021-04-05 13:04:46-00'), + (4, 2, 8724, 4, '2021-06-01 17:36:00-00'), + (41, 3, 5046, 4, '2021-05-25 22:17:21-00'), + (18, 5, 7751, 2, '2021-06-16 1:23:26-00'), + (16, 2, 3355, 4, '2021-04-25 11:42:49-00'), + (48, 2, 9550, 2, '2021-06-17 2:27:24-00'), + (46, 3, 9692, 5, '2021-06-11 6:59:01-00'), + (49, 3, 72, 1, '2021-04-20 8:38:34-00'), + (40, 4, 8446, 3, '2021-06-25 3:07:29-00'), + (26, 2, 8008, 3, '2021-04-14 20:18:44-00'), + (53, 1, 9204, 1, '2021-04-10 14:19:56-00'), + (8, 1, 8509, 4, '2021-04-23 7:43:54-00'), + (12, 4, 5563, 3, '2021-05-10 8:34:41-00'), + (2, 4, 2962, 3, '2021-04-08 5:26:51-00'), + (17, 4, 207, 3, '2021-05-21 11:38:40-00'), + (45, 1, 1064, 3, '2021-06-07 12:55:52-00'), + (5, 2, 5978, 4, '2021-05-26 1:55:31-00'), + (32, 2, 3542, 5, '2021-06-22 9:16:41-00'), + (37, 3, 436, 2, '2021-06-20 22:55:48-00'), + (20, 1, 1850, 4, '2021-06-24 18:17:35-00'), + (30, 5, 8440, 4, '2021-05-12 0:45:55-00'), + (37, 5, 2180, 4, '2021-05-25 9:45:19-00'), + (10, 5, 6724, 4, '2021-06-07 5:21:00-00'), + (35, 4, 3746, 5, '2021-06-24 18:06:06-00'), + (13, 2, 3593, 2, '2021-04-25 3:57:22-00'), + (6, 2, 3243, 5, '2021-05-06 19:04:49-00'), + (43, 5, 2404, 2, '2021-05-23 5:11:56-00'), + (28, 5, 1011, 5, '2021-04-06 11:36:42-00'), + (27, 1, 3981, 4, '2021-06-11 18:59:31-00'), + (28, 1, 8904, 3, '2021-05-22 2:24:03-00'), + (36, 3, 3752, 4, '2021-05-28 21:23:24-00'), + (59, 5, 4427, 4, '2021-06-06 19:36:28-00'), + (38, 3, 4568, 5, '2021-06-04 10:58:45-00'), + (23, 3, 2799, 3, '2021-04-08 5:54:23-00'), + (43, 3, 9474, 1, '2021-04-04 5:07:51-00'), + (11, 4, 4413, 4, '2021-05-18 5:53:02-00'), + (27, 5, 880, 5, '2021-04-24 0:05:02-00'), + (12, 3, 6477, 3, '2021-04-09 16:50:02-00'), + (2, 1, 5419, 3, '2021-04-04 4:02:48-00'), + (42, 1, 1006, 2, '2021-06-03 0:55:27-00'), + (7, 4, 4368, 3, '2021-04-01 14:58:27-00'), + (53, 2, 6382, 4, '2021-06-23 11:45:23-00'), + (14, 3, 9020, 2, '2021-05-03 7:31:24-00'), + (13, 2, 4128, 3, '2021-04-13 10:42:16-00'), + (9, 1, 15, 2, '2021-05-09 12:10:40-00'), + (18, 4, 3503, 5, '2021-06-16 13:47:09-00'), + (57, 2, 9030, 3, '2021-04-23 1:45:11-00'), + (8, 3, 9100, 4, '2021-06-03 11:26:16-00'), + (60, 1, 9117, 3, '2021-06-09 7:01:57-00'), + (33, 4, 6920, 4, '2021-04-02 21:29:29-00'), + (34, 5, 3559, 2, '2021-06-01 10:32:03-00'), + (7, 3, 8206, 4, '2021-04-10 23:10:38-00'), + (45, 3, 9125, 3, '2021-05-02 1:20:03-00'), + (58, 4, 3225, 2, '2021-06-13 11:03:54-00'), + (39, 4, 2967, 4, '2021-06-26 23:30:37-00'), + (18, 2, 6370, 1, '2021-06-19 10:58:25-00'), + (43, 5, 803, 2, '2021-05-22 19:12:47-00'), + (59, 5, 2146, 4, '2021-05-28 13:09:08-00'), + (53, 1, 6846, 5, '2021-05-25 14:37:40-00'), + (22, 5, 7010, 2, '2021-06-14 7:55:01-00'), + (25, 5, 4121, 1, '2021-04-01 9:51:16-00'), + (41, 3, 6483, 5, '2021-05-16 22:34:43-00'), + (28, 5, 4459, 5, '2021-05-04 16:20:20-00'), + (24, 2, 2563, 2, '2021-06-05 7:06:00-00'), + (54, 5, 8091, 5, '2021-06-01 1:40:32-00'), + (28, 2, 9841, 1, '2021-04-22 14:15:05-00'), + (41, 2, 8376, 1, '2021-04-14 15:42:53-00'), + (55, 5, 2505, 2, '2021-04-19 14:50:12-00'), + (27, 2, 295, 3, '2021-06-24 21:21:04-00'), + (23, 5, 1560, 4, '2021-06-10 6:51:55-00'), + (18, 5, 5198, 5, '2021-04-05 1:34:15-00'), + (49, 4, 7544, 1, '2021-05-05 8:43:46-00'), + (28, 2, 9534, 4, '2021-04-14 2:52:35-00'), + (11, 2, 753, 5, '2021-04-04 16:32:45-00'), + (21, 2, 9373, 1, '2021-06-16 1:15:02-00'), + (20, 4, 3978, 1, '2021-05-17 23:28:48-00'), + (16, 5, 1691, 2, '2021-06-13 5:31:34-00'), + (26, 3, 1085, 4, '2021-06-17 18:51:55-00'), + (5, 1, 3896, 2, '2021-04-18 4:08:16-00'), + (59, 1, 4426, 1, '2021-06-01 1:55:50-00'), + (16, 2, 4818, 3, '2021-06-16 6:31:38-00'), + (25, 2, 1747, 4, '2021-05-21 3:44:53-00'), + (26, 3, 2228, 5, '2021-06-15 12:02:49-00'), + (11, 1, 3186, 2, '2021-05-08 0:15:26-00'), + (52, 3, 5800, 4, '2021-06-24 4:39:19-00'), + (35, 2, 5933, 3, '2021-05-20 4:15:10-00'), + (35, 1, 3046, 2, '2021-05-18 16:02:39-00'), + (54, 4, 3065, 3, '2021-06-02 5:18:14-00'), + (4, 4, 9206, 2, '2021-05-10 19:01:23-00'), + (45, 4, 1359, 4, '2021-06-18 6:53:01-00'), + (1, 3, 3038, 2, '2021-04-26 16:29:58-00'), + (12, 3, 4182, 4, '2021-04-07 8:46:32-00'), + (47, 5, 7343, 1, '2021-04-04 20:38:22-00'), + (44, 2, 7620, 1, '2021-06-05 13:21:44-00'), + (55, 1, 8183, 2, '2021-06-12 11:30:08-00'), + (41, 5, 4874, 4, '2021-06-07 12:23:54-00'), + (57, 4, 5264, 2, '2021-04-14 5:08:06-00'), + (16, 5, 9230, 5, '2021-06-06 15:41:33-00'), + (52, 5, 3814, 1, '2021-05-18 14:37:09-00'), + (9, 5, 6943, 3, '2021-06-27 23:23:01-00'), + (32, 3, 1669, 1, '2021-05-05 11:46:48-00'), + (21, 1, 2556, 5, '2021-04-15 13:11:10-00'), + (11, 4, 1518, 3, '2021-06-22 3:08:47-00'), + (28, 1, 6202, 4, '2021-04-25 9:22:03-00'), + (16, 1, 6369, 5, '2021-04-02 15:21:48-00'), + (13, 4, 7852, 2, '2021-05-24 2:10:16-00'), + (36, 3, 8324, 2, '2021-05-13 0:23:05-00'), + (44, 5, 2966, 2, '2021-06-23 2:55:18-00'), + (37, 3, 9969, 5, '2021-04-19 22:33:01-00'), + (9, 5, 8968, 3, '2021-04-14 22:31:11-00'), + (3, 4, 7848, 1, '2021-04-24 7:55:53-00'), + (36, 1, 8806, 4, '2021-06-09 9:44:02-00'), + (49, 1, 8172, 5, '2021-06-15 23:07:01-00'), + (59, 3, 5757, 3, '2021-04-24 23:11:29-00'), + (27, 3, 447, 2, '2021-06-15 9:29:36-00'), + (8, 2, 224, 2, '2021-05-25 7:01:54-00'), + (1, 2, 9795, 5, '2021-06-11 20:04:18-00'), + (12, 4, 4264, 1, '2021-05-16 15:08:28-00'), + (46, 1, 1428, 3, '2021-06-16 3:41:39-00'), + (17, 2, 5874, 4, '2021-04-28 3:39:07-00'), + (5, 2, 8362, 1, '2021-05-04 11:51:30-00'), + (40, 4, 9871, 1, '2021-05-22 14:39:55-00'), + (18, 3, 4589, 5, '2021-05-13 16:15:19-00'), + (13, 3, 3102, 3, '2021-05-28 2:13:11-00'), + (34, 4, 1482, 3, '2021-04-24 6:53:07-00'), + (10, 4, 8639, 3, '2021-05-07 20:15:00-00'), + (20, 4, 4847, 4, '2021-05-02 7:56:59-00'), + (51, 2, 3763, 5, '2021-05-10 23:31:30-00'), + (16, 1, 7441, 3, '2021-04-21 16:48:28-00'), + (17, 1, 8944, 3, '2021-06-08 14:04:46-00'), + (38, 2, 8367, 3, '2021-06-16 18:22:54-00'), + (21, 5, 3837, 1, '2021-04-04 20:22:56-00'), + (16, 3, 6715, 2, '2021-06-22 15:30:33-00'), + (6, 5, 6067, 2, '2021-04-01 10:35:40-00'), + (32, 1, 3626, 5, '2021-06-02 17:55:20-00'), + (10, 5, 5335, 3, '2021-06-25 3:54:11-00'), + (39, 2, 880, 3, '2021-05-20 20:48:42-00'), + (4, 2, 3034, 1, '2021-06-10 8:55:45-00'), + (30, 1, 6600, 1, '2021-05-25 15:23:35-00'), + (20, 5, 3401, 4, '2021-05-13 6:13:17-00'), + (9, 3, 648, 2, '2021-06-26 22:58:52-00'), + (54, 1, 154, 2, '2021-04-15 7:42:40-00'), + (32, 2, 4898, 2, '2021-06-12 13:38:13-00'), + (1, 5, 7650, 3, '2021-06-12 15:35:59-00'), + (15, 4, 8640, 2, '2021-06-24 4:16:56-00'), + (36, 4, 1361, 3, '2021-05-01 22:37:10-00'), + (28, 5, 2965, 2, '2021-06-23 14:57:04-00'), + (16, 2, 3858, 1, '2021-05-03 17:57:28-00'), + (28, 5, 3206, 1, '2021-06-24 6:07:50-00'), + (59, 5, 6871, 2, '2021-06-01 22:59:17-00'), + (40, 4, 5090, 4, '2021-06-24 3:04:26-00'), + (38, 2, 9796, 3, '2021-05-07 14:58:54-00'), + (14, 1, 9764, 2, '2021-06-17 16:06:16-00'), + (50, 1, 1830, 2, '2021-05-12 23:28:53-00'), + (55, 2, 5953, 1, '2021-04-24 11:24:43-00'), + (59, 5, 2936, 1, '2021-04-15 3:46:54-00'), + (36, 3, 6370, 3, '2021-05-05 14:03:14-00'), + (41, 2, 5043, 3, '2021-05-18 18:51:55-00'), + (37, 1, 1702, 1, '2021-05-01 2:31:59-00'), + (11, 4, 7052, 2, '2021-04-06 2:19:28-00'), + (36, 2, 3496, 5, '2021-05-23 16:01:20-00'), + (57, 2, 8383, 5, '2021-06-01 12:03:07-00'), + (52, 1, 1208, 5, '2021-06-01 3:15:48-00'), + (57, 2, 3845, 4, '2021-04-28 19:25:17-00'), + (1, 5, 4436, 5, '2021-05-10 2:55:26-00'), + (40, 5, 824, 3, '2021-06-13 13:01:33-00'), + (3, 4, 3411, 5, '2021-06-09 22:44:47-00'), + (27, 5, 2490, 4, '2021-05-23 12:15:08-00'), + (21, 2, 6900, 2, '2021-05-09 15:03:11-00'), + (16, 5, 3007, 4, '2021-05-21 6:50:01-00'), + (50, 1, 195, 2, '2021-06-07 4:47:10-00'), + (36, 2, 124, 4, '2021-05-22 4:13:57-00'), + (48, 1, 2644, 4, '2021-04-09 1:10:07-00'), + (15, 4, 7861, 1, '2021-06-24 22:33:41-00'), + (5, 3, 2591, 5, '2021-04-14 11:25:08-00'), + (12, 5, 6523, 4, '2021-05-24 2:16:38-00'), + (30, 1, 4661, 4, '2021-05-04 0:21:28-00'), + (1, 4, 5, 4, '2021-05-07 8:28:26-00'), + (4, 4, 62, 5, '2021-04-20 15:09:44-00'), + (56, 4, 3224, 4, '2021-06-06 7:56:05-00'), + (41, 5, 2137, 3, '2021-04-01 19:13:02-00'), + (40, 5, 9703, 2, '2021-06-12 3:07:24-00'), + (17, 1, 6674, 3, '2021-06-05 9:30:31-00'), + (28, 5, 4679, 5, '2021-05-20 20:03:59-00'), + (6, 5, 8683, 1, '2021-06-19 3:59:37-00'), + (9, 3, 9238, 3, '2021-05-25 7:31:06-00'), + (60, 4, 518, 5, '2021-04-08 19:07:14-00'), + (49, 4, 5537, 2, '2021-06-26 21:15:18-00'), + (16, 1, 7311, 1, '2021-06-10 18:27:56-00'), + (52, 3, 569, 3, '2021-05-08 10:20:48-00'), + (37, 3, 8186, 3, '2021-05-03 10:06:27-00'), + (16, 2, 17, 5, '2021-06-18 1:43:47-00'), + (16, 5, 3262, 1, '2021-05-16 9:32:45-00'), + (48, 3, 9753, 2, '2021-05-22 11:51:17-00'), + (12, 5, 9761, 1, '2021-06-05 12:19:55-00'), + (8, 1, 6541, 5, '2021-06-10 0:14:01-00'), + (3, 2, 8872, 2, '2021-06-02 13:22:52-00'), + (46, 2, 2677, 1, '2021-04-02 4:47:11-00'), + (16, 5, 3622, 5, '2021-04-15 6:10:12-00'), + (29, 4, 1077, 4, '2021-06-03 7:22:52-00'), + (49, 1, 4779, 4, '2021-05-20 1:18:51-00'), + (22, 2, 2262, 2, '2021-06-23 7:14:23-00'), + (31, 4, 1888, 3, '2021-04-25 9:20:54-00'), + (35, 3, 6532, 2, '2021-04-26 7:43:30-00'), + (29, 4, 4887, 4, '2021-05-12 19:33:34-00'), + (6, 3, 5841, 3, '2021-06-23 23:02:07-00'), + (6, 5, 7307, 2, '2021-04-22 18:22:19-00'), + (40, 5, 5718, 1, '2021-06-20 10:30:25-00'), + (15, 1, 8417, 5, '2021-05-09 16:37:14-00'), + (9, 4, 384, 3, '2021-05-06 11:09:23-00'), + (30, 1, 8662, 4, '2021-05-20 17:14:25-00'), + (59, 5, 9877, 3, '2021-05-27 18:17:41-00'), + (42, 5, 4550, 4, '2021-06-26 8:46:56-00'), + (59, 2, 4016, 2, '2021-05-21 2:52:16-00'), + (42, 1, 3896, 5, '2021-04-24 21:34:16-00'), + (53, 5, 3337, 5, '2021-05-24 10:56:58-00'), + (13, 1, 1114, 4, '2021-04-17 11:56:52-00'), + (52, 5, 9926, 3, '2021-04-15 14:57:55-00'), + (29, 4, 1750, 4, '2021-06-24 3:13:46-00'), + (57, 2, 6171, 1, '2021-04-21 17:17:34-00'), + (24, 3, 8079, 5, '2021-05-21 19:12:34-00'), + (35, 2, 4689, 4, '2021-04-15 5:21:37-00'), + (42, 5, 8262, 5, '2021-05-12 16:55:45-00'), + (14, 1, 4660, 5, '2021-05-16 9:21:08-00'), + (56, 4, 8699, 4, '2021-05-12 11:11:40-00'), + (53, 4, 8893, 1, '2021-04-22 6:30:08-00'), + (27, 5, 8564, 1, '2021-05-03 13:16:03-00'), + (51, 4, 7541, 2, '2021-06-25 18:46:02-00'), + (58, 1, 2102, 3, '2021-04-28 2:42:24-00'), + (57, 3, 2114, 4, '2021-06-17 23:56:36-00'), + (46, 5, 548, 1, '2021-04-03 9:04:40-00'), + (6, 1, 5778, 5, '2021-06-12 12:55:03-00'), + (25, 4, 6951, 4, '2021-04-27 14:51:11-00'), + (46, 2, 6446, 5, '2021-04-04 7:19:26-00'), + (58, 2, 1408, 4, '2021-06-22 0:08:02-00'), + (12, 2, 9439, 3, '2021-04-02 15:52:57-00'), + (55, 5, 231, 3, '2021-04-08 3:42:59-00'), + (35, 2, 1067, 2, '2021-06-28 2:56:00-00'), + (60, 4, 3071, 1, '2021-06-21 17:13:50-00'), + (43, 4, 5244, 1, '2021-04-08 4:08:59-00'), + (15, 1, 6631, 4, '2021-06-02 12:24:07-00'), + (50, 5, 2979, 1, '2021-05-01 5:51:43-00'), + (13, 2, 7315, 3, '2021-06-21 5:47:37-00'), + (15, 1, 8983, 1, '2021-05-06 19:18:44-00'), + (23, 3, 1544, 3, '2021-04-07 4:45:59-00'), + (13, 1, 3209, 1, '2021-04-14 3:16:50-00'), + (42, 1, 3137, 2, '2021-04-27 23:49:18-00'), + (6, 4, 8638, 5, '2021-06-07 13:41:28-00'), + (8, 5, 8371, 4, '2021-06-03 19:24:21-00'), + (7, 5, 9566, 1, '2021-04-01 8:42:25-00'), + (12, 4, 5750, 3, '2021-06-12 4:19:08-00'), + (20, 1, 6137, 4, '2021-06-28 15:17:22-00'), + (10, 3, 8798, 4, '2021-04-05 0:18:22-00'), + (29, 5, 9844, 3, '2021-06-13 21:52:56-00'), + (28, 4, 107, 2, '2021-06-18 17:11:55-00'), + (38, 4, 7287, 2, '2021-06-01 6:02:43-00'), + (3, 3, 6884, 3, '2021-06-18 3:06:16-00'), + (21, 3, 8525, 5, '2021-06-19 0:57:59-00'), + (13, 1, 2418, 2, '2021-06-28 18:30:50-00'), + (51, 4, 6832, 3, '2021-04-06 11:02:12-00'), + (13, 3, 6538, 5, '2021-06-02 20:40:06-00'), + (22, 4, 5479, 3, '2021-06-11 19:42:38-00'), + (29, 3, 7697, 5, '2021-06-09 21:16:16-00'), + (54, 5, 9655, 4, '2021-06-28 23:42:28-00'), + (4, 2, 4660, 1, '2021-04-18 13:30:41-00'), + (40, 4, 9664, 2, '2021-06-28 14:11:39-00'), + (3, 2, 204, 2, '2021-06-26 5:10:16-00'), + (28, 1, 6188, 1, '2021-04-06 2:19:34-00'), + (4, 5, 4984, 4, '2021-05-18 1:27:54-00'), + (43, 1, 8329, 2, '2021-06-15 3:49:35-00'), + (31, 4, 8086, 4, '2021-06-18 10:46:55-00'), + (39, 2, 21, 5, '2021-06-03 15:53:13-00'), + (29, 1, 1736, 3, '2021-04-28 23:28:35-00'), + (45, 3, 8542, 1, '2021-06-20 16:18:28-00'), + (7, 5, 8498, 5, '2021-06-26 4:43:07-00'), + (29, 3, 6774, 4, '2021-06-17 7:59:04-00'), + (22, 5, 5589, 5, '2021-06-08 7:24:45-00'), + (15, 4, 2807, 2, '2021-05-01 23:06:22-00'), + (11, 4, 9525, 4, '2021-04-26 20:44:00-00'), + (31, 4, 7098, 4, '2021-04-04 15:15:56-00'), + (2, 3, 613, 5, '2021-06-09 15:09:00-00'), + (15, 2, 4243, 2, '2021-04-20 2:51:22-00'), + (46, 3, 6230, 4, '2021-05-15 9:21:08-00'), + (56, 1, 4762, 2, '2021-06-01 20:42:57-00'), + (23, 3, 8014, 5, '2021-06-01 15:28:34-00'), + (4, 1, 4755, 4, '2021-04-15 2:00:57-00'), + (39, 4, 9098, 4, '2021-06-14 22:01:01-00'), + (17, 2, 2028, 5, '2021-06-08 19:33:52-00'), + (39, 5, 9105, 5, '2021-04-18 14:08:19-00'), + (37, 5, 7815, 5, '2021-04-05 18:08:23-00'), + (3, 5, 1099, 2, '2021-06-28 14:36:59-00'), + (44, 1, 7313, 2, '2021-05-16 13:07:12-00'), + (42, 3, 9801, 2, '2021-05-24 11:15:40-00'), + (32, 5, 558, 2, '2021-05-26 16:25:41-00'), + (9, 3, 8178, 5, '2021-06-09 21:59:42-00'), + (38, 1, 5113, 5, '2021-04-15 2:20:33-00'), + (16, 5, 4325, 5, '2021-05-26 16:53:28-00'), + (20, 4, 6062, 2, '2021-06-28 6:18:26-00'), + (6, 2, 8109, 3, '2021-05-13 14:28:05-00'), + (23, 2, 4529, 3, '2021-04-02 6:15:07-00'), + (37, 4, 576, 5, '2021-04-04 12:38:15-00'), + (10, 4, 1853, 2, '2021-06-27 8:39:25-00'), + (39, 3, 8919, 2, '2021-06-03 18:36:42-00'), + (3, 4, 671, 2, '2021-06-09 11:19:40-00'), + (33, 1, 566, 2, '2021-05-08 10:39:33-00'), + (25, 5, 201, 3, '2021-06-22 3:41:00-00'), + (21, 1, 992, 5, '2021-06-21 3:01:08-00'), + (4, 2, 6376, 5, '2021-04-24 4:27:49-00'), + (10, 2, 1255, 4, '2021-06-18 9:49:37-00'), + (39, 4, 2334, 5, '2021-04-17 20:41:30-00'), + (21, 1, 3044, 1, '2021-06-18 16:23:28-00'), + (28, 2, 7930, 5, '2021-04-01 5:02:19-00'), + (52, 4, 2608, 5, '2021-06-28 2:16:22-00'), + (51, 3, 7276, 3, '2021-04-25 23:24:34-00'), + (20, 2, 7476, 3, '2021-04-10 16:10:27-00'), + (35, 1, 8883, 4, '2021-06-01 13:47:41-00'), + (11, 4, 91, 2, '2021-06-09 22:19:14-00'), + (12, 4, 6256, 3, '2021-04-03 19:35:57-00'), + (38, 5, 4900, 3, '2021-06-22 4:26:34-00'), + (44, 5, 1715, 2, '2021-05-06 22:49:43-00'), + (5, 1, 1418, 5, '2021-06-17 22:26:27-00'), + (4, 5, 6750, 2, '2021-06-09 20:03:41-00'), + (18, 1, 1727, 5, '2021-06-04 20:18:00-00'), + (18, 1, 9583, 4, '2021-04-03 17:26:37-00'), + (14, 3, 4228, 2, '2021-05-25 5:09:53-00'), + (5, 2, 3319, 2, '2021-06-01 1:04:05-00'), + (53, 1, 7430, 1, '2021-06-14 9:19:05-00'), + (10, 3, 155, 2, '2021-06-28 3:55:20-00'), + (11, 4, 3378, 4, '2021-04-18 23:33:51-00'), + (24, 2, 7449, 3, '2021-06-01 10:10:11-00'), + (52, 5, 864, 3, '2021-06-25 23:44:50-00'), + (9, 3, 6164, 1, '2021-06-14 21:25:28-00'), + (6, 5, 4474, 2, '2021-04-22 15:02:37-00'), + (57, 5, 4274, 1, '2021-05-26 3:37:57-00'), + (2, 3, 4308, 4, '2021-04-02 13:22:33-00'), + (50, 1, 8994, 3, '2021-05-04 17:11:20-00'), + (10, 1, 3835, 3, '2021-04-18 20:35:33-00'), + (17, 2, 1706, 1, '2021-05-12 8:34:37-00'), + (4, 3, 4855, 4, '2021-06-05 22:37:08-00'), + (15, 2, 2511, 5, '2021-05-12 12:18:47-00'), + (14, 4, 1761, 3, '2021-04-04 22:08:39-00'), + (12, 1, 891, 4, '2021-05-14 23:09:42-00'), + (16, 5, 9379, 4, '2021-04-03 9:14:46-00'), + (9, 3, 6762, 5, '2021-06-09 2:48:55-00'), + (1, 4, 6799, 5, '2021-04-24 15:05:01-00'), + (47, 1, 2868, 2, '2021-04-24 22:01:20-00'), + (15, 1, 4093, 5, '2021-05-05 0:42:32-00'), + (17, 4, 4382, 1, '2021-04-17 2:28:50-00'), + (13, 4, 8850, 5, '2021-06-11 13:07:00-00'), + (46, 5, 2081, 4, '2021-06-08 6:47:00-00'), + (51, 5, 2292, 3, '2021-04-23 4:54:42-00'), + (24, 5, 1034, 3, '2021-04-20 19:32:27-00'), + (54, 5, 8441, 1, '2021-05-14 0:04:34-00'), + (4, 2, 5548, 2, '2021-05-17 12:40:18-00'), + (60, 2, 5167, 3, '2021-06-06 21:38:39-00'), + (12, 1, 3137, 2, '2021-04-08 2:33:14-00'), + (59, 4, 7896, 3, '2021-06-04 3:41:16-00'), + (22, 5, 2435, 5, '2021-04-28 3:13:45-00'), + (6, 5, 772, 3, '2021-04-14 14:20:26-00'), + (47, 3, 1496, 4, '2021-04-24 19:41:59-00'), + (47, 3, 3790, 4, '2021-06-08 16:46:51-00'), + (53, 2, 3126, 2, '2021-04-26 11:02:20-00'), + (4, 3, 6701, 1, '2021-04-22 7:05:47-00'), + (46, 2, 1432, 4, '2021-05-17 7:13:12-00'), + (20, 1, 8998, 3, '2021-06-19 20:37:00-00'), + (59, 4, 4771, 3, '2021-05-26 2:25:06-00'), + (13, 3, 3768, 1, '2021-05-21 15:30:52-00'), + (3, 4, 8884, 3, '2021-05-17 18:11:12-00'), + (31, 4, 1757, 3, '2021-04-27 5:19:20-00'), + (29, 2, 9430, 5, '2021-04-17 5:13:01-00'), + (55, 2, 6712, 5, '2021-06-03 8:27:37-00'), + (21, 1, 576, 3, '2021-04-03 3:00:23-00'), + (4, 1, 1957, 1, '2021-04-01 7:45:54-00'), + (30, 3, 4260, 5, '2021-06-03 16:38:21-00'), + (40, 2, 6063, 1, '2021-06-25 0:50:29-00'), + (46, 5, 1255, 4, '2021-06-16 6:52:47-00'), + (6, 1, 4147, 5, '2021-04-16 3:22:00-00'), + (10, 4, 8094, 5, '2021-06-12 22:18:20-00'), + (43, 4, 2512, 1, '2021-06-09 9:22:59-00'), + (46, 3, 9431, 3, '2021-06-21 17:23:57-00'), + (20, 1, 5496, 5, '2021-06-16 21:43:29-00'), + (38, 3, 9891, 4, '2021-06-14 20:08:00-00'), + (40, 3, 8533, 5, '2021-04-16 10:18:38-00'), + (53, 2, 7561, 1, '2021-06-15 1:47:47-00'), + (25, 2, 5814, 3, '2021-04-23 21:00:06-00'), + (37, 3, 9091, 1, '2021-06-14 23:18:59-00'), + (33, 5, 1123, 2, '2021-04-03 16:37:17-00'), + (28, 1, 6762, 2, '2021-05-11 17:31:13-00'), + (48, 4, 7016, 5, '2021-04-08 21:07:52-00'), + (35, 3, 4950, 3, '2021-04-23 1:27:31-00'), + (30, 3, 9302, 3, '2021-04-13 17:00:24-00'), + (44, 2, 803, 4, '2021-06-28 8:13:38-00'), + (6, 4, 9481, 4, '2021-06-16 7:13:32-00'), + (56, 5, 2987, 1, '2021-04-10 23:23:10-00'), + (30, 5, 8790, 2, '2021-06-28 17:50:14-00'), + (30, 2, 4471, 3, '2021-04-03 21:40:25-00'), + (3, 5, 8201, 2, '2021-04-23 8:34:48-00'), + (56, 4, 4909, 1, '2021-06-07 14:52:16-00'), + (47, 1, 6069, 3, '2021-04-19 18:43:39-00'), + (15, 4, 5159, 5, '2021-05-01 14:49:30-00'), + (18, 5, 4870, 2, '2021-06-16 14:48:50-00'), + (9, 3, 390, 2, '2021-05-14 23:41:05-00'), + (44, 5, 9471, 1, '2021-05-28 3:19:08-00'), + (41, 3, 6514, 5, '2021-05-21 1:51:11-00'), + (35, 1, 5185, 2, '2021-06-10 11:08:35-00'), + (50, 3, 9448, 3, '2021-04-17 20:05:21-00'), + (56, 2, 5306, 3, '2021-06-15 6:20:06-00'), + (59, 1, 4954, 2, '2021-04-09 2:26:53-00'), + (36, 4, 2150, 3, '2021-05-13 16:27:50-00'), + (30, 1, 766, 1, '2021-06-07 11:22:37-00'), + (17, 1, 9962, 2, '2021-05-18 9:17:57-00'), + (19, 1, 1798, 3, '2021-04-03 17:57:29-00'), + (8, 3, 6443, 1, '2021-04-15 17:53:40-00'), + (9, 5, 8382, 1, '2021-05-22 16:41:32-00'), + (18, 1, 4784, 4, '2021-05-19 7:56:50-00'), + (16, 5, 6562, 2, '2021-05-10 14:14:53-00'), + (9, 5, 8451, 3, '2021-05-23 22:39:52-00'), + (26, 4, 6777, 1, '2021-05-24 4:32:58-00'), + (23, 3, 8938, 1, '2021-05-08 10:07:44-00'), + (43, 4, 7927, 1, '2021-04-11 19:16:20-00'), + (52, 3, 2242, 1, '2021-04-14 0:40:25-00'), + (45, 5, 3640, 2, '2021-06-02 22:30:22-00'), + (10, 5, 6128, 2, '2021-04-25 3:46:12-00'), + (50, 4, 1997, 3, '2021-06-22 4:06:47-00'), + (17, 2, 9113, 1, '2021-06-12 11:28:28-00'), + (5, 4, 7109, 2, '2021-06-27 10:45:12-00'), + (1, 3, 8551, 5, '2021-05-16 8:20:48-00'), + (42, 5, 7132, 2, '2021-06-20 8:45:55-00'), + (31, 4, 1522, 2, '2021-05-15 23:20:45-00'), + (17, 1, 6571, 3, '2021-06-10 15:58:32-00'), + (21, 2, 5682, 5, '2021-05-08 3:14:47-00'), + (10, 5, 3888, 1, '2021-04-01 6:48:08-00'), + (23, 3, 5907, 5, '2021-05-04 21:43:54-00'), + (53, 2, 1430, 1, '2021-04-04 5:17:26-00'), + (30, 2, 6008, 4, '2021-04-21 21:01:11-00'), + (17, 2, 6783, 4, '2021-06-20 15:27:52-00'), + (26, 5, 6668, 4, '2021-05-27 4:50:55-00'), + (2, 3, 3453, 5, '2021-06-10 4:32:24-00'), + (18, 1, 2729, 2, '2021-06-25 7:33:52-00'), + (48, 2, 3618, 1, '2021-06-12 4:02:32-00'), + (29, 5, 2535, 3, '2021-04-09 12:33:27-00'), + (3, 3, 416, 3, '2021-05-23 15:15:46-00'), + (35, 5, 1473, 2, '2021-05-06 18:13:29-00'), + (12, 4, 218, 1, '2021-04-07 20:04:37-00'), + (55, 3, 6681, 5, '2021-04-09 4:28:02-00'), + (2, 5, 1806, 4, '2021-06-28 16:00:38-00'), + (58, 2, 3408, 1, '2021-05-23 23:23:39-00'), + (31, 1, 7137, 5, '2021-04-13 6:02:10-00'), + (14, 3, 3843, 4, '2021-06-26 19:07:54-00'), + (19, 4, 4451, 3, '2021-06-23 4:52:43-00'), + (37, 5, 1591, 4, '2021-05-02 7:22:42-00'), + (19, 5, 1327, 3, '2021-04-20 4:46:06-00'), + (43, 5, 6133, 3, '2021-06-24 1:39:44-00'), + (32, 2, 941, 1, '2021-05-26 6:40:41-00'), + (34, 4, 7234, 4, '2021-06-10 21:58:10-00'), + (30, 1, 1690, 1, '2021-06-06 12:42:37-00'), + (7, 1, 7104, 5, '2021-05-09 22:21:36-00'), + (57, 1, 5346, 3, '2021-05-26 18:14:38-00'), + (28, 3, 9914, 3, '2021-05-18 21:43:12-00'), + (1, 4, 5974, 1, '2021-04-12 20:49:16-00'), + (38, 1, 2751, 2, '2021-05-15 14:36:50-00'), + (60, 2, 8598, 1, '2021-05-24 23:24:54-00'), + (18, 4, 6970, 3, '2021-04-20 6:27:35-00'), + (60, 2, 9629, 1, '2021-06-27 5:08:27-00'), + (32, 1, 9873, 4, '2021-04-01 4:11:37-00'), + (34, 3, 8537, 2, '2021-05-11 12:18:40-00'), + (5, 5, 7372, 1, '2021-06-03 5:42:54-00'), + (1, 5, 1951, 2, '2021-06-15 8:18:43-00'), + (57, 3, 5637, 1, '2021-04-08 21:28:45-00'), + (38, 3, 6918, 2, '2021-04-13 16:15:21-00'), + (11, 4, 2283, 5, '2021-04-04 13:06:13-00'), + (13, 5, 4731, 4, '2021-04-06 19:28:59-00'), + (24, 2, 1908, 1, '2021-04-10 11:46:18-00'), + (50, 1, 4409, 1, '2021-05-28 14:17:33-00'), + (50, 2, 8636, 4, '2021-05-25 16:08:43-00'), + (23, 1, 3023, 2, '2021-04-13 17:27:22-00'), + (60, 5, 4859, 2, '2021-06-27 17:50:15-00'), + (40, 3, 9373, 4, '2021-05-16 8:15:55-00'), + (38, 5, 8958, 3, '2021-04-19 19:14:43-00'), + (2, 5, 4998, 1, '2021-05-05 16:20:59-00'), + (3, 3, 5634, 2, '2021-06-17 4:58:20-00'), + (22, 3, 8460, 5, '2021-04-13 4:01:30-00'), + (17, 3, 8471, 5, '2021-06-16 14:22:23-00'), + (23, 3, 9916, 2, '2021-06-14 23:56:49-00'), + (46, 3, 8555, 5, '2021-06-26 6:36:11-00'), + (45, 4, 3790, 3, '2021-06-02 19:27:43-00'), + (30, 4, 4267, 3, '2021-05-26 1:38:49-00'), + (14, 4, 8315, 3, '2021-04-14 6:59:37-00'), + (30, 1, 5967, 4, '2021-04-13 17:20:43-00'), + (16, 2, 6358, 1, '2021-06-16 14:52:26-00'), + (15, 1, 6773, 4, '2021-06-13 17:14:01-00'), + (4, 4, 7147, 2, '2021-05-07 12:15:12-00'), + (52, 2, 2717, 4, '2021-05-21 18:17:27-00'), + (32, 1, 5751, 5, '2021-06-04 8:08:55-00'), + (43, 3, 3790, 2, '2021-05-05 14:44:50-00'), + (3, 2, 2100, 2, '2021-06-02 9:08:26-00'), + (6, 1, 9474, 3, '2021-06-22 19:43:55-00'), + (25, 2, 577, 3, '2021-05-08 3:05:45-00'), + (59, 2, 1779, 4, '2021-06-13 0:32:03-00'), + (10, 1, 5348, 2, '2021-05-13 8:24:29-00'), + (51, 4, 2100, 5, '2021-04-23 0:56:39-00'), + (20, 2, 3278, 1, '2021-06-18 5:50:55-00'), + (4, 1, 941, 2, '2021-06-15 23:34:25-00'), + (14, 4, 4303, 1, '2021-04-14 2:52:50-00'), + (55, 2, 5423, 4, '2021-04-02 3:07:15-00'), + (23, 3, 185, 2, '2021-06-22 2:26:00-00'), + (20, 1, 8053, 3, '2021-04-16 4:57:29-00'), + (24, 2, 9865, 1, '2021-06-19 3:45:49-00'), + (14, 5, 1060, 1, '2021-04-20 0:53:34-00'), + (15, 5, 4209, 4, '2021-06-26 2:16:05-00'), + (22, 4, 8203, 2, '2021-05-17 16:02:10-00') ; From eef1ef1d60e8c1ce2a980d031289f3970b090a7b Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 15:54:32 +0200 Subject: [PATCH 13/57] change queries for new leaderboard setup --- server/database/mock-follows.sql | 3 +- server/src/queries.cr | 249 +++++++++++++++++++++++++------ 2 files changed, 208 insertions(+), 44 deletions(-) diff --git a/server/database/mock-follows.sql b/server/database/mock-follows.sql index c32c1dc..b98b020 100644 --- a/server/database/mock-follows.sql +++ b/server/database/mock-follows.sql @@ -106,4 +106,5 @@ VALUES (60, 11), (60, 26), (60, 34), - (60, 38) \ No newline at end of file + (60, 38) +; \ No newline at end of file diff --git a/server/src/queries.cr b/server/src/queries.cr index 99c6820..8576390 100644 --- a/server/src/queries.cr +++ b/server/src/queries.cr @@ -1,67 +1,230 @@ module Queries extend self - USER_UPSERT = - "INSERT INTO users + USER_UPSERT = " + INSERT INTO users VALUES ($1, $2, $3) ON CONFLICT(userid) DO - UPDATE SET name = EXCLUDED.name, access = EXCLUDED.access" + UPDATE SET name = EXCLUDED.name, access = EXCLUDED.access + " - USER_FROM_ID = - "SELECT userID, name + USER_FROM_ID = " + SELECT userID, name FROM users - WHERE userID = $1 limit 1" + WHERE userID = $1 limit 1 + " - TOTAL_SCORE_FROM_ID = - "SELECT SUM (score) AS score + TOTAL_SCORE_FROM_ID = " + SELECT SUM (score) AS score FROM contributions - WHERE userID = $1" + WHERE userID = $1 + " - ACHIEVEMENTS_FROM_ID = - "SELECT a.name, a.description + ACHIEVEMENTS_FROM_ID = " + SELECT a.name, a.description FROM (SELECT * FROM unlocked WHERE userID = $1) AS u INNER JOIN achievements AS a - ON u.achievement = a.achievementID" + ON u.achievement = a.achievementID + " - FOLLOWERS_FROM_ID = - "SELECT userID, name + FOLLOWERS_FROM_ID = " + SELECT userID, name FROM follows INNER JOIN users ON follower = userID - WHERE followee = $1" + WHERE followee = $1 + " - FOLLOWING_FROM_ID = - "SELECT userID, name - FROM - follows INNER JOIN users + FOLLOWING_FROM_ID = " + SELECT userID, name + FROM follows INNER JOIN users ON followee = userID - WHERE follower = $1" + WHERE follower = $1 + " - GLOBAL_ALL_TIME = - "SELECT u.userID, u.name, s.score - FROM - (SELECT userID, SUM (score) AS score - FROM contributions - GROUP BY userID) - AS s - INNER JOIN - users AS u - ON u.userID = s.userID - ORDER BY score DESC" + GLOBAL_ALL_TIME_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardAllTime + WHERE score != 0 OR userID = $1) AS l + WHERE userID = $1 + " - GLOBAL_INTERVAL = - "SELECT u.userID, u.name, s.score - FROM - (SELECT userID, SUM (score) AS score - FROM contributions - WHERE dateTime > $1 AND datetime < $2 - GROUP BY userID) - AS s - INNER JOIN - users AS u - ON u.userID = s.userID - ORDER BY score DESC" + GLOBAL_MONTHLY_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardMonthly + WHERE score != 0 OR userID = $1) AS l + WHERE userID = $1 + " + + GLOBAL_WEEKLY_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardWeekly + WHERE score != 0 OR userID = $1) AS l + WHERE userID = $1 + " + + PERSONAL_ALL_TIME_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardAllTime + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1)) AS l + WHERE userID = $1 + " + + PERSONAL_MONTHLY_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardMonthly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1)) AS l + WHERE userID = $1 + " + + PERSONAL_WEEKLY_RANK = " + SELECT l.rnum + FROM ( + SELECT userID, score, row_number() OVER () as rnum + FROM leaderboardWeekly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1)) AS l + WHERE userID = $1 + " + + PERSONAL_ALL_TIME_COUNT = " + SELECT COUNT(*) + FROM leaderboardAllTime + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1) + " + + PERSONAL_MONTHLY_COUNT = " + SELECT COUNT(*) + FROM leaderboardMonthly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1) + " + + PERSONAL_WEEKLY_COUNT = " + SELECT COUNT(*) + FROM leaderboardWeekly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + AND + (score != 0 OR userID = $1) + " + + GLOBAL_ALL_TIME_COUNT = " + SELECT COUNT(*) + FROM leaderboardAllTime + WHERE score != 0 + " + + GLOBAL_MONTHLY_COUNT = " + SELECT COUNT(*) + FROM leaderboardMonthly + WHERE score != 0 + " + + GLOBAL_WEEKLY_COUNT = " + SELECT COUNT(*) + FROM leaderboardWeekly + WHERE score != 0 + " + + GLOBAL_ALL_TIME = " + SELECT * + FROM leaderboardAllTime + WHERE score != 0 + " + + GLOBAL_MONTHLY = " + SELECT * + FROM leaderboardMonthly + WHERE score != 0 + " + + GLOBAL_WEEKLY = " + SELECT * + FROM leaderboardWeekly + WHERE score != 0 + " + + PERSONAL_ALL_TIME = " + SELECT * + FROM leaderboardAllTime + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + " + + PERSONAL_MONTHLY = " + SELECT * + FROM leaderboardMonthly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + " + + PERSONAL_WEEKLY = " + SELECT * + FROM leaderboardWeekly + WHERE + EXISTS ( + SELECT 1 + FROM follows + WHERE userID = $1 OR (follower = $1 AND followee = userID) + ) + " end From b051282b4f9af6d14af5b1d61b2066614db8d6a4 Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 15:54:49 +0200 Subject: [PATCH 14/57] add placements to users --- server/src/maptogether-server.cr | 103 ++++++++++++++++++++++++++++--- server/src/placement.cr | 35 +++++++++++ server/src/user.cr | 13 +++- 3 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 server/src/placement.cr diff --git a/server/src/maptogether-server.cr b/server/src/maptogether-server.cr index f0addf0..5b537d1 100644 --- a/server/src/maptogether-server.cr +++ b/server/src/maptogether-server.cr @@ -8,6 +8,7 @@ require "./leaderboard.cr" require "./queries.cr" require "./achievement.cr" require "./contribution.cr" +require "./placement.cr" module MapTogether::Server module Endpoints @@ -96,6 +97,45 @@ module MapTogether::Server user.following << User.new(user_id: rows.read(Int64), name: rows.read(String)) end end + + user.leaderboards = [ + Placement.new( + "Global", + Leaderboard_Type::All_Time, + db.query_one Queries::GLOBAL_ALL_TIME_RANK, as:{Int64}, + db.query_one Queries::GLOBAL_ALL_TIME_TOTAL + ), + Placement.new( + "Global", + Leaderboard_Type::Monthly, + db.query_one Queries::GLOBAL_MONTHLY_RANK, as:{Int64}, + db.query_one Queries::GLOBAL_MONTHLY_TOTAL + ), + Placement.new( + "Global", + Leaderboard_Type::Weekly, + db.query_one Queries::GLOBAL_WEEKLY_RANK, as:{Int64}, + db.query_one Queries::GLOBAL_WEEKLY_TOTAL + ), + Placement.new( + "Personal", + Leaderboard_Type::All_Time, + db.query_one Queries::PERSONAL_ALL_TIME_RANK, as:{Int64}, + db.query_one Queries::PERSONAL_ALL_TIME_TOTAL + ), + Placement.new( + "Personal", + Leaderboard_Type::Monthly, + db.query_one Queries::PERSONAL_MONTHLY_RANK, as:{Int64}, + db.query_one Queries::PERSONAL_MONTHLY_TOTAL + ), + Placement.new( + "Personal", + Leaderboard_Type::Weekly, + db.query_one Queries::PERSONAL_WEEKLY_RANK, as:{Int64}, + db.query_one Queries::PERSONAL_WEEKLY_TOTAL + ) + ] end env.response.content_type = "application/json" @@ -127,8 +167,57 @@ module MapTogether::Server end end + + get "/leaderboard/all_time/personal/:id" do |env| + id = env.params.url["id"] + + string = JSON.build do |json| + try_open_connection do |db| + check_auth(id, env, db) + db.query Queries::PERSONAL_ALL_TIME, id do |rows| + Leaderboard.new(rows).to_json json + end + end + end + + env.response.content_type = "application/json" + string + end + + get "/leaderboard/weekly/personal/:id" do |env| + id = env.params.url["id"] + + string = JSON.build do |json| + try_open_connection do |db| + check_auth(id, env, db) + db.query Queries::PERSONAL_WEEKLY, id do |rows| + Leaderboard.new(rows).to_json json + end + end + end + + env.response.content_type = "application/json" + string + end + + get "/leaderboard/monthly/personal/:id" do |env| + id = env.params.url["id"] + + string = JSON.build do |json| + try_open_connection do |db| + check_auth(id, env, db) + db.query Queries::PERSONAL_MONTHLY, id do |rows| + Leaderboard.new(rows).to_json json + end + end + end + + env.response.content_type = "application/json" + string + end + # Retrieve all users' id, name and score - get "/leaderboard/global/all_time" do |env| + get "/leaderboard/all_time/global" do |env| string = JSON.build do |json| try_open_connection do |db| db.query Queries::GLOBAL_ALL_TIME do |rows| @@ -140,24 +229,24 @@ module MapTogether::Server env.response.content_type = "application/json" string end - - get "/leaderboard/global/monthly" do |env| + + get "/leaderboard/monthly/global" do |env| string = JSON.build do |json| try_open_connection do |db| - db.query Queries::GLOBAL_INTERVAL, Time.utc.at_beginning_of_month, Time.utc.at_end_of_month do |rows| + db.query Queries::GLOBAL_MONTHLY do |rows| Leaderboard.new(rows).to_json json end end end - + env.response.content_type = "application/json" string end - get "/leaderboard/global/weekly" do |env| + get "/leaderboard/weekly/global" do |env| string = JSON.build do |json| try_open_connection do |db| - db.query Queries::GLOBAL_INTERVAL, Time.utc.at_beginning_of_week, Time.utc.at_end_of_week do |rows| + db.query Queries::GLOBAL_WEEKLY do |rows| Leaderboard.new(rows).to_json json end end diff --git a/server/src/placement.cr b/server/src/placement.cr new file mode 100644 index 0000000..5946d6b --- /dev/null +++ b/server/src/placement.cr @@ -0,0 +1,35 @@ +enum Leaderboard_Type + Weekly + Monthly + All_Time + + def to_string + "Weekly" if self == Leaderboard_Type::Weekly + "Monthly" if self == Leaderboard_Type::Monthly + "All_time" if self == Leaderboard_Type::All_Time + end +end + +class Placement + property leaderboard : String + property type : Leaderboard_Type + property rank : Int32 + property total : Int32 + + def initialize( + @leaderboard : String, + @type : Leaderboard_Type, + @rank : Int32, + @total : Int32 + ) + end + + def to_json(json : JSON::Builder) + json.object do + json.field "leaderboard", @leaderboard + json.field "type", @type.to_string + json.field "rank", @rank + json.field "total", @total + end + end +end \ No newline at end of file diff --git a/server/src/user.cr b/server/src/user.cr index 44e2ab2..801270b 100644 --- a/server/src/user.cr +++ b/server/src/user.cr @@ -1,4 +1,5 @@ require "./achievement.cr" +require "./placement.cr" class User property user_id : Nil | Int64 @@ -7,6 +8,7 @@ class User property achievements : Array(Achievement) property followers : Array(User) property following : Array(User) + property leaderboards : Array(Placement) def initialize( @user_id = nil, @@ -14,7 +16,8 @@ class User @score = nil, @achievements = [] of Achievement, @followers = [] of User, - @following = [] of User + @following = [] of User, + @leaderboards = [] of Placement ) end @@ -47,6 +50,14 @@ class User end end end unless @following.size == 0 + + json.field "leaderboards" do + json.array do + @leaderboards.each do |placement| + placement.to_json(json) + end + end + end unless @leaderboards.size == 0 end end end From 68e2a4c10dd74f59ef0555e7e29505404d25451f Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Wed, 19 May 2021 16:00:14 +0200 Subject: [PATCH 15/57] client&mtapi: Fix montly->monthly spelling mistake causing error --- client/lib/widgets/social_menu_widgets/overview.dart | 2 +- maptogether_api/lib/src/api.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index c300f68..927e92f 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -67,7 +67,7 @@ class _OverviewView extends State with TickerProviderStateMixin{ controller: _nestedTabController, children: [ leaderBoardWidget(LeaderboardType.all_time), - leaderBoardWidget(LeaderboardType.montly), + leaderBoardWidget(LeaderboardType.monthly), leaderBoardWidget(LeaderboardType.weekly), ]) ) diff --git a/maptogether_api/lib/src/api.dart b/maptogether_api/lib/src/api.dart index 4079b20..0145de0 100644 --- a/maptogether_api/lib/src/api.dart +++ b/maptogether_api/lib/src/api.dart @@ -2,13 +2,13 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'data.dart' as data; -enum LeaderboardType { weekly, montly, all_time } +enum LeaderboardType { weekly, monthly, all_time } String stringify(LeaderboardType type) { switch (type) { case LeaderboardType.weekly: return "weekly"; - case LeaderboardType.montly: - return "montly"; + case LeaderboardType.monthly: + return "monthly"; case LeaderboardType.all_time: return "all_time"; } From 670eaf8ca1be15abea024f7630d4284f622c817e Mon Sep 17 00:00:00 2001 From: "Thomas M.G" Date: Wed, 19 May 2021 16:13:59 +0200 Subject: [PATCH 16/57] fix syntax errors --- server/src/maptogether-server.cr | 26 +++++++++++++------------- server/src/placement.cr | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/src/maptogether-server.cr b/server/src/maptogether-server.cr index 5b537d1..5338ee3 100644 --- a/server/src/maptogether-server.cr +++ b/server/src/maptogether-server.cr @@ -97,43 +97,43 @@ module MapTogether::Server user.following << User.new(user_id: rows.read(Int64), name: rows.read(String)) end end - + user.leaderboards = [ Placement.new( "Global", Leaderboard_Type::All_Time, - db.query_one Queries::GLOBAL_ALL_TIME_RANK, as:{Int64}, - db.query_one Queries::GLOBAL_ALL_TIME_TOTAL + db.query_one(Queries::GLOBAL_ALL_TIME_RANK, as: Int64), + db.query_one(Queries::GLOBAL_ALL_TIME_COUNT, as: Int64) ), Placement.new( "Global", Leaderboard_Type::Monthly, - db.query_one Queries::GLOBAL_MONTHLY_RANK, as:{Int64}, - db.query_one Queries::GLOBAL_MONTHLY_TOTAL + db.query_one(Queries::GLOBAL_MONTHLY_RANK, as: Int64), + db.query_one(Queries::GLOBAL_MONTHLY_COUNT, as: Int64) ), Placement.new( "Global", Leaderboard_Type::Weekly, - db.query_one Queries::GLOBAL_WEEKLY_RANK, as:{Int64}, - db.query_one Queries::GLOBAL_WEEKLY_TOTAL + db.query_one(Queries::GLOBAL_WEEKLY_RANK, as: Int64), + db.query_one(Queries::GLOBAL_WEEKLY_COUNT, as: Int64) ), Placement.new( "Personal", Leaderboard_Type::All_Time, - db.query_one Queries::PERSONAL_ALL_TIME_RANK, as:{Int64}, - db.query_one Queries::PERSONAL_ALL_TIME_TOTAL + db.query_one(Queries::PERSONAL_ALL_TIME_RANK, id, as: Int64), + db.query_one(Queries::PERSONAL_ALL_TIME_COUNT, id, as: Int64) ), Placement.new( "Personal", Leaderboard_Type::Monthly, - db.query_one Queries::PERSONAL_MONTHLY_RANK, as:{Int64}, - db.query_one Queries::PERSONAL_MONTHLY_TOTAL + db.query_one(Queries::PERSONAL_MONTHLY_RANK, id, as: Int64), + db.query_one(Queries::PERSONAL_MONTHLY_COUNT, id, as: Int64) ), Placement.new( "Personal", Leaderboard_Type::Weekly, - db.query_one Queries::PERSONAL_WEEKLY_RANK, as:{Int64}, - db.query_one Queries::PERSONAL_WEEKLY_TOTAL + db.query_one(Queries::PERSONAL_WEEKLY_RANK, id, as: Int64), + db.query_one(Queries::PERSONAL_WEEKLY_COUNT, id, as: Int64) ) ] end diff --git a/server/src/placement.cr b/server/src/placement.cr index 5946d6b..e1d4ca2 100644 --- a/server/src/placement.cr +++ b/server/src/placement.cr @@ -13,14 +13,14 @@ end class Placement property leaderboard : String property type : Leaderboard_Type - property rank : Int32 - property total : Int32 + property rank : Int64 + property total : Int64 def initialize( @leaderboard : String, @type : Leaderboard_Type, - @rank : Int32, - @total : Int32 + @rank : Int64, + @total : Int64 ) end From 4128a861c08c2c6b47b966daf58a25583a1955cd Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Wed, 19 May 2021 16:23:01 +0200 Subject: [PATCH 17/57] client: Remove UserTest and DummyDatabase test code --- client/lib/database.dart | 90 ------------------- client/lib/main.dart | 6 +- client/lib/screens/login_screen.dart | 1 - client/lib/screens/map_screen.dart | 1 - client/lib/screens/social_screen.dart | 1 - .../social_menu_widgets/add_friend.dart | 3 +- .../widgets/social_menu_widgets/friends.dart | 13 +-- .../social_menu_widgets/leaderboard.dart | 2 - .../widgets/social_menu_widgets/overview.dart | 2 - .../lib/widgets/social_menu_widgets/user.dart | 13 --- .../social_menu_widgets/user_overview.dart | 1 - 11 files changed, 4 insertions(+), 129 deletions(-) delete mode 100644 client/lib/database.dart delete mode 100644 client/lib/widgets/social_menu_widgets/user.dart diff --git a/client/lib/database.dart b/client/lib/database.dart deleted file mode 100644 index bc08890..0000000 --- a/client/lib/database.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:client/widgets/social_menu_widgets/user.dart'; -import 'package:flutter/foundation.dart'; - -//We get the current user through their username, usernames are unique, -//for the purpose of testing we are Simon - -class LeaderBoardTest{ - String name; - List users; - - LeaderBoardTest(this.name, this.users){ - users.sort((a, b) => b.total.compareTo(a.total)); - } -} - -class DummyDatabase with ChangeNotifier{ - - String loginURL = ""; - String currentUserName; - UserTest currentUser; - - List globalUsers; - List leaderboards; - List followingNames; - List following; - - DummyDatabase() { - currentUserName = "Simon"; - - //This is the list of all users to ever use the app, it makes up the global leaderboard. - globalUsers = [ - UserTest("Thomas", 40, 25, 15, "kid.png", "UK"), - UserTest("Sebba", 250, 150, 55, "clean.png", "DK"), - UserTest("Simon", 25, 15, 5, "business.png", "DK"), - UserTest("Phillip", 55, 35, 15, "arthas.png", "DK"), - UserTest("Hartvig", 10, 10, 0, "anime.png", "JP"), - UserTest("Fjeldsø", 20, 20, 10, "wolf.png", "DK"), - ]; - - followingNames = [ - "Thomas", - "Hartvig", - "Sebba", - "Fjeldsø", - "Phillip", - ]; - - //currentUser found in the global list through - currentUser = globalUsers.firstWhere((user) => - user.name == currentUserName); - - //Setting up Leaderboards - LeaderBoardTest national = new LeaderBoardTest(currentUser.nationality, - globalUsers.where((user) => user.nationality == currentUser.nationality) - .toList()); - - following = globalUsers.where((user) => - followingNames.contains(user.name)).toList(); - - LeaderBoardTest world = new LeaderBoardTest("World", globalUsers); - - LeaderBoardTest followLB = new LeaderBoardTest("Follow", following); - - leaderboards = [world, national, followLB]; - - - } - - void givePoints(int x){ - currentUser.total += x; - notifyListeners(); - } - - void followNew(String toFollow){ - UserTest userToFollow = globalUsers.firstWhere((user) => user.name == toFollow, orElse: () => null); - if(userToFollow == null) - print("User does not exist"); - - else if(followingNames.contains(toFollow)) - print("Already following"); - - else { - followingNames.add(toFollow); - following.add(userToFollow); - } - - notifyListeners(); - } - -} diff --git a/client/lib/main.dart b/client/lib/main.dart index 3b00c4c..e758d69 100644 --- a/client/lib/main.dart +++ b/client/lib/main.dart @@ -6,14 +6,12 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; -import 'database.dart'; void main() => runApp( MultiProvider(providers: [ - ChangeNotifierProvider(create: (_) => DummyDatabase()), ChangeNotifierProvider(create: (_) => LoginHandler()), ChangeNotifierProvider(create: (_) => LocationHandler()), - ChangeNotifierProvider(create: (_) => QuestHandler()) + ChangeNotifierProvider(create: (_) => QuestHandler()), ], child: MyApp()), ); @@ -21,7 +19,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: '${context.watch().currentUserName}', + title: 'MapTogether', theme: ThemeData( primaryColor: Colors.lightGreen, primarySwatch: Colors.lightGreen, diff --git a/client/lib/screens/login_screen.dart b/client/lib/screens/login_screen.dart index 559907c..35f8f36 100644 --- a/client/lib/screens/login_screen.dart +++ b/client/lib/screens/login_screen.dart @@ -5,7 +5,6 @@ import 'package:provider/provider.dart'; import 'package:webview_flutter/webview_flutter.dart'; import 'package:client/widgets/app_bar.dart'; -import 'package:client/database.dart'; import 'package:client/login_handler.dart'; import 'package:client/screens/social_screen.dart'; diff --git a/client/lib/screens/map_screen.dart b/client/lib/screens/map_screen.dart index 7231757..811e080 100644 --- a/client/lib/screens/map_screen.dart +++ b/client/lib/screens/map_screen.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:latlong/latlong.dart'; -import 'package:client/database.dart'; import 'package:client/location_handler.dart'; import 'package:client/login_handler.dart'; diff --git a/client/lib/screens/social_screen.dart b/client/lib/screens/social_screen.dart index 3f7fd8f..a4790cf 100644 --- a/client/lib/screens/social_screen.dart +++ b/client/lib/screens/social_screen.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:client/database.dart'; import 'package:client/widgets/app_bar.dart'; import 'package:client/widgets/social_menu_widgets/friends.dart'; import 'package:client/widgets/social_menu_widgets/groups.dart'; diff --git a/client/lib/widgets/social_menu_widgets/add_friend.dart b/client/lib/widgets/social_menu_widgets/add_friend.dart index 9474e23..6bcacc3 100644 --- a/client/lib/widgets/social_menu_widgets/add_friend.dart +++ b/client/lib/widgets/social_menu_widgets/add_friend.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:client/widgets/app_bar.dart'; import 'friends.dart'; -import 'package:client/database.dart'; import 'package:provider/provider.dart'; class AddFriend extends StatelessWidget { @@ -53,7 +52,7 @@ class AddFriend extends StatelessWidget { child: Text('Follow'), onPressed: () { //Add friend to backend for user here - context.read().followNew(nameController.text); + print("FOLLOW SOMEONE"); print(nameController.text); Navigator.pop(context); }, diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social_menu_widgets/friends.dart index 8c9a049..e16038e 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social_menu_widgets/friends.dart @@ -1,8 +1,6 @@ import 'package:client/widgets/social_menu_widgets/leaderboard.dart'; import 'package:client/widgets/social_menu_widgets/add_friend.dart'; import 'package:flutter/material.dart'; -import 'user.dart'; -import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'package:client/data_fetchers.dart'; @@ -45,16 +43,7 @@ class Friends extends StatelessWidget { backgroundColor: Colors.red ), onPressed: () { - context - .read() - .followingNames - .remove(context - .read() - .following[index].name); - context - .read() - .following - .removeAt(index); + print("UNFOLLOW SOMEONE"); Navigator.pop(context); }, ), diff --git a/client/lib/widgets/social_menu_widgets/leaderboard.dart b/client/lib/widgets/social_menu_widgets/leaderboard.dart index 7031fc3..9e012ca 100644 --- a/client/lib/widgets/social_menu_widgets/leaderboard.dart +++ b/client/lib/widgets/social_menu_widgets/leaderboard.dart @@ -4,10 +4,8 @@ import 'package:flutter/rendering.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'package:provider/provider.dart'; -import 'package:client/database.dart'; import 'package:client/widgets/app_bar.dart'; import 'package:client/data_fetchers.dart'; -import 'package:client/widgets/social_menu_widgets/user.dart'; class LeaderBoardView extends StatelessWidget { int leaderboardIndex; diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social_menu_widgets/overview.dart index 927e92f..963b248 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social_menu_widgets/overview.dart @@ -2,8 +2,6 @@ import 'package:client/widgets/social_menu_widgets/user_overview.dart'; import 'package:flutter/material.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'leaderboard.dart'; -import 'user.dart'; -import 'package:client/database.dart'; import 'package:provider/provider.dart'; import 'package:client/data_fetchers.dart'; diff --git a/client/lib/widgets/social_menu_widgets/user.dart b/client/lib/widgets/social_menu_widgets/user.dart deleted file mode 100644 index 4976b57..0000000 --- a/client/lib/widgets/social_menu_widgets/user.dart +++ /dev/null @@ -1,13 +0,0 @@ -class UserTest { - String name; //name of user - int total; - int weekly; - int daily; - String pfp; - String nationality; - //Eventuelt gem på tasks brugere laver i en task class, her samt et time stamp, vi kan så få - //weekly/daily score ved bare at tage ting i et specifikt interval - - - UserTest(this.name, this.total, this.weekly, this.daily, this.pfp, this.nationality); -} \ No newline at end of file diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social_menu_widgets/user_overview.dart index 007fec7..a566f27 100644 --- a/client/lib/widgets/social_menu_widgets/user_overview.dart +++ b/client/lib/widgets/social_menu_widgets/user_overview.dart @@ -1,4 +1,3 @@ -import 'package:client/database.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; From a1a9048103bd45978389a3725e576c5d679c2862 Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Thu, 20 May 2021 08:49:03 +0200 Subject: [PATCH 18/57] client: login_screen -> login_flow, social_menu_widgets -> social and map_widgets -> map --- .../{screens/login_screen.dart => login_flow.dart} | 0 client/lib/screens/map_screen.dart | 10 +++++----- client/lib/screens/social_screen.dart | 12 ++++++------ client/lib/widgets/{map_widgets => map}/map.dart | 2 +- .../map_screen_button_widgets/button_row.dart | 0 .../map_screen_button_widgets/map_screen_button.dart | 0 .../map_screen_button_widgets/pup_up_menu.dart | 2 +- .../{social_menu_widgets => social}/add_friend.dart | 0 .../create_group.dart | 0 .../{social_menu_widgets => social}/friends.dart | 4 ++-- .../{social_menu_widgets => social}/groups.dart | 2 +- .../{social_menu_widgets => social}/history.dart | 0 .../{social_menu_widgets => social}/leaderboard.dart | 0 .../{social_menu_widgets => social}/overview.dart | 2 +- .../user_overview.dart | 0 15 files changed, 17 insertions(+), 17 deletions(-) rename client/lib/{screens/login_screen.dart => login_flow.dart} (100%) rename client/lib/widgets/{map_widgets => map}/map.dart (99%) rename client/lib/widgets/{map_widgets => map}/map_screen_button_widgets/button_row.dart (100%) rename client/lib/widgets/{map_widgets => map}/map_screen_button_widgets/map_screen_button.dart (100%) rename client/lib/widgets/{map_widgets => map}/map_screen_button_widgets/pup_up_menu.dart (97%) rename client/lib/widgets/{social_menu_widgets => social}/add_friend.dart (100%) rename client/lib/widgets/{social_menu_widgets => social}/create_group.dart (100%) rename client/lib/widgets/{social_menu_widgets => social}/friends.dart (96%) rename client/lib/widgets/{social_menu_widgets => social}/groups.dart (92%) rename client/lib/widgets/{social_menu_widgets => social}/history.dart (100%) rename client/lib/widgets/{social_menu_widgets => social}/leaderboard.dart (100%) rename client/lib/widgets/{social_menu_widgets => social}/overview.dart (97%) rename client/lib/widgets/{social_menu_widgets => social}/user_overview.dart (100%) diff --git a/client/lib/screens/login_screen.dart b/client/lib/login_flow.dart similarity index 100% rename from client/lib/screens/login_screen.dart rename to client/lib/login_flow.dart diff --git a/client/lib/screens/map_screen.dart b/client/lib/screens/map_screen.dart index 811e080..29d73e4 100644 --- a/client/lib/screens/map_screen.dart +++ b/client/lib/screens/map_screen.dart @@ -10,12 +10,12 @@ import 'package:client/quests/bench_quest/backrest_bench_quest.dart'; import 'package:client/quests/quest_handler.dart'; import 'package:client/screens/social_screen.dart'; -import 'package:client/screens/login_screen.dart'; +import 'package:client/login_flow.dart'; -import 'package:client/widgets/map_widgets/map.dart'; -import 'package:client/widgets/map_widgets/map_screen_button_widgets/button_row.dart'; -import 'package:client/widgets/map_widgets/map_screen_button_widgets/map_screen_button.dart'; -import 'package:client/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart'; +import 'package:client/widgets/map/map.dart'; +import 'package:client/widgets/map/map_screen_button_widgets/button_row.dart'; +import 'package:client/widgets/map/map_screen_button_widgets/map_screen_button.dart'; +import 'package:client/widgets/map/map_screen_button_widgets/pup_up_menu.dart'; launchSocial(BuildContext context) => diff --git a/client/lib/screens/social_screen.dart b/client/lib/screens/social_screen.dart index a4790cf..e960757 100644 --- a/client/lib/screens/social_screen.dart +++ b/client/lib/screens/social_screen.dart @@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:client/widgets/app_bar.dart'; -import 'package:client/widgets/social_menu_widgets/friends.dart'; -import 'package:client/widgets/social_menu_widgets/groups.dart'; -import 'package:client/widgets/social_menu_widgets/history.dart'; -import 'package:client/widgets/social_menu_widgets/overview.dart'; -import 'package:client/widgets/social_menu_widgets/user_overview.dart'; -import 'package:client/screens/login_screen.dart'; +import 'package:client/widgets/social/friends.dart'; +import 'package:client/widgets/social/groups.dart'; +import 'package:client/widgets/social/history.dart'; +import 'package:client/widgets/social/overview.dart'; +import 'package:client/widgets/social/user_overview.dart'; +import 'package:client/login_flow.dart'; import 'package:client/login_handler.dart'; class SocialScreen extends StatefulWidget { diff --git a/client/lib/widgets/map_widgets/map.dart b/client/lib/widgets/map/map.dart similarity index 99% rename from client/lib/widgets/map_widgets/map.dart rename to client/lib/widgets/map/map.dart index 2a791ea..497a701 100644 --- a/client/lib/widgets/map_widgets/map.dart +++ b/client/lib/widgets/map/map.dart @@ -9,7 +9,7 @@ import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart'; import 'package:latlong/latlong.dart'; import 'package:provider/provider.dart'; import 'package:time_range_picker/time_range_picker.dart'; -import 'package:client/screens/login_screen.dart'; +import 'package:client/login_flow.dart'; class PointOfInterest { // TODO: I think this should be moved to some model package diff --git a/client/lib/widgets/map_widgets/map_screen_button_widgets/button_row.dart b/client/lib/widgets/map/map_screen_button_widgets/button_row.dart similarity index 100% rename from client/lib/widgets/map_widgets/map_screen_button_widgets/button_row.dart rename to client/lib/widgets/map/map_screen_button_widgets/button_row.dart diff --git a/client/lib/widgets/map_widgets/map_screen_button_widgets/map_screen_button.dart b/client/lib/widgets/map/map_screen_button_widgets/map_screen_button.dart similarity index 100% rename from client/lib/widgets/map_widgets/map_screen_button_widgets/map_screen_button.dart rename to client/lib/widgets/map/map_screen_button_widgets/map_screen_button.dart diff --git a/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart b/client/lib/widgets/map/map_screen_button_widgets/pup_up_menu.dart similarity index 97% rename from client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart rename to client/lib/widgets/map/map_screen_button_widgets/pup_up_menu.dart index 07e80bc..f3d2deb 100644 --- a/client/lib/widgets/map_widgets/map_screen_button_widgets/pup_up_menu.dart +++ b/client/lib/widgets/map/map_screen_button_widgets/pup_up_menu.dart @@ -1,6 +1,6 @@ import 'package:client/screens/new_activity_screen.dart'; import 'package:client/screens/settings_screen.dart'; -import 'package:client/screens/login_screen.dart'; +import 'package:client/login_flow.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; diff --git a/client/lib/widgets/social_menu_widgets/add_friend.dart b/client/lib/widgets/social/add_friend.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/add_friend.dart rename to client/lib/widgets/social/add_friend.dart diff --git a/client/lib/widgets/social_menu_widgets/create_group.dart b/client/lib/widgets/social/create_group.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/create_group.dart rename to client/lib/widgets/social/create_group.dart diff --git a/client/lib/widgets/social_menu_widgets/friends.dart b/client/lib/widgets/social/friends.dart similarity index 96% rename from client/lib/widgets/social_menu_widgets/friends.dart rename to client/lib/widgets/social/friends.dart index e16038e..a7b9751 100644 --- a/client/lib/widgets/social_menu_widgets/friends.dart +++ b/client/lib/widgets/social/friends.dart @@ -1,5 +1,5 @@ -import 'package:client/widgets/social_menu_widgets/leaderboard.dart'; -import 'package:client/widgets/social_menu_widgets/add_friend.dart'; +import 'package:client/widgets/social/leaderboard.dart'; +import 'package:client/widgets/social/add_friend.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:maptogether_api/maptogether_api.dart'; diff --git a/client/lib/widgets/social_menu_widgets/groups.dart b/client/lib/widgets/social/groups.dart similarity index 92% rename from client/lib/widgets/social_menu_widgets/groups.dart rename to client/lib/widgets/social/groups.dart index 342cd3a..005d89d 100644 --- a/client/lib/widgets/social_menu_widgets/groups.dart +++ b/client/lib/widgets/social/groups.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:client/widgets/social_menu_widgets/create_group.dart'; +import 'package:client/widgets/social/create_group.dart'; class Groups extends StatelessWidget { @override diff --git a/client/lib/widgets/social_menu_widgets/history.dart b/client/lib/widgets/social/history.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/history.dart rename to client/lib/widgets/social/history.dart diff --git a/client/lib/widgets/social_menu_widgets/leaderboard.dart b/client/lib/widgets/social/leaderboard.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/leaderboard.dart rename to client/lib/widgets/social/leaderboard.dart diff --git a/client/lib/widgets/social_menu_widgets/overview.dart b/client/lib/widgets/social/overview.dart similarity index 97% rename from client/lib/widgets/social_menu_widgets/overview.dart rename to client/lib/widgets/social/overview.dart index 963b248..e18355a 100644 --- a/client/lib/widgets/social_menu_widgets/overview.dart +++ b/client/lib/widgets/social/overview.dart @@ -1,4 +1,4 @@ -import 'package:client/widgets/social_menu_widgets/user_overview.dart'; +import 'package:client/widgets/social/user_overview.dart'; import 'package:flutter/material.dart'; import 'package:maptogether_api/maptogether_api.dart'; import 'leaderboard.dart'; diff --git a/client/lib/widgets/social_menu_widgets/user_overview.dart b/client/lib/widgets/social/user_overview.dart similarity index 100% rename from client/lib/widgets/social_menu_widgets/user_overview.dart rename to client/lib/widgets/social/user_overview.dart From 6318c1f898830f943c542b25734be6aebf694452 Mon Sep 17 00:00:00 2001 From: SEbbaDK Date: Thu, 20 May 2021 08:51:00 +0200 Subject: [PATCH 19/57] client: Rename map_screen_button_widgets -> button --- client/lib/screens/map_screen.dart | 6 +++--- .../{map_screen_button_widgets => buttons}/button_row.dart | 0 .../map_screen_button.dart | 0 .../{map_screen_button_widgets => buttons}/pup_up_menu.dart | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename client/lib/widgets/map/{map_screen_button_widgets => buttons}/button_row.dart (100%) rename client/lib/widgets/map/{map_screen_button_widgets => buttons}/map_screen_button.dart (100%) rename client/lib/widgets/map/{map_screen_button_widgets => buttons}/pup_up_menu.dart (100%) diff --git a/client/lib/screens/map_screen.dart b/client/lib/screens/map_screen.dart index 29d73e4..673d04d 100644 --- a/client/lib/screens/map_screen.dart +++ b/client/lib/screens/map_screen.dart @@ -13,9 +13,9 @@ import 'package:client/screens/social_screen.dart'; import 'package:client/login_flow.dart'; import 'package:client/widgets/map/map.dart'; -import 'package:client/widgets/map/map_screen_button_widgets/button_row.dart'; -import 'package:client/widgets/map/map_screen_button_widgets/map_screen_button.dart'; -import 'package:client/widgets/map/map_screen_button_widgets/pup_up_menu.dart'; +import 'package:client/widgets/map/button/button_row.dart'; +import 'package:client/widgets/map/button/map_screen_button.dart'; +import 'package:client/widgets/map/button/pup_up_menu.dart'; launchSocial(BuildContext context) => diff --git a/client/lib/widgets/map/map_screen_button_widgets/button_row.dart b/client/lib/widgets/map/buttons/button_row.dart similarity index 100% rename from client/lib/widgets/map/map_screen_button_widgets/button_row.dart rename to client/lib/widgets/map/buttons/button_row.dart diff --git a/client/lib/widgets/map/map_screen_button_widgets/map_screen_button.dart b/client/lib/widgets/map/buttons/map_screen_button.dart similarity index 100% rename from client/lib/widgets/map/map_screen_button_widgets/map_screen_button.dart rename to client/lib/widgets/map/buttons/map_screen_button.dart diff --git a/client/lib/widgets/map/map_screen_button_widgets/pup_up_menu.dart b/client/lib/widgets/map/buttons/pup_up_menu.dart similarity index 100% rename from client/lib/widgets/map/map_screen_button_widgets/pup_up_menu.dart rename to client/lib/widgets/map/buttons/pup_up_menu.dart From f097a09e67695844182c2b342f4fff3405cd4c3d Mon Sep 17 00:00:00 2001 From: Thomas <33622552+ThomasMG@users.noreply.github.com> Date: Thu, 20 May 2021 08:51:42 +0200 Subject: [PATCH 20/57] Add new leaderboard endpoints and user rankings --- server/README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/server/README.md b/server/README.md index d9d7868..e86bf01 100644 --- a/server/README.md +++ b/server/README.md @@ -16,27 +16,48 @@ Responds with json object of a user like this: "description": }, ... - ] + ], "followers": [ { "id": , "name": }, ... - ] + ], "following": [ { "id": , "name": }, ... - ] + ], + "leaderboards": [ + { + "leaderboard": , + "type": , + "rank": , + "total": + }, + ... + ], } ``` -### `/leaderboard/global/all_time` Get Global All-time Leaderboard +### `/leaderboard/