Exemple #1
0
        public async Task GetLeaderboardAsync([Name("uživatel")] IUser user = null)
        {
            if (user == null)
            {
                await GetLeaderboardAsync(0);

                return;
            }

            var pos = await PointsService.GetUserPositionAsync(user);

            await GetLeaderboardAsync(pos);
        }
Exemple #2
0
        public async Task GetWeeklyLeaderboardAsync(EnumArg.TimeSpan span, [Name("uživatel")] IUser user = null)
        {
            var from = span switch
            {
                EnumArg.TimeSpan.Today => DateTime.Today,
                EnumArg.TimeSpan.Week => DateTime.Today.AddDays(-6),
                EnumArg.TimeSpan.Month => DateTime.Today.AddMonths(-1).AddDays(1),
                _ => throw new NotImplementedException()
            };

            if (user == null)
            {
                await GetLeaderboardAsync(0, from);

                return;
            }

            var pos = await PointsService.GetUserPositionAsync(user);

            await GetLeaderboardAsync(pos, from);
        }