Merge branch 'v6' into docs-beta
This commit is contained in:
commit
ea06e9f217
3 changed files with 13 additions and 5 deletions
src/EllieBot
|
@ -469,22 +469,23 @@ public sealed class FishService(
|
||||||
return catches;
|
return catches;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IReadOnlyCollection<(ulong UserId, int Catches)>> GetFishLbAsync(int page)
|
public async Task<IReadOnlyCollection<(ulong UserId, int Catches, int Unique)>> GetFishLbAsync(int page)
|
||||||
{
|
{
|
||||||
await using var ctx = db.GetDbContext();
|
await using var ctx = db.GetDbContext();
|
||||||
|
|
||||||
var result = await ctx.GetTable<FishCatch>()
|
var result = await ctx.GetTable<FishCatch>()
|
||||||
.GroupBy(x => x.UserId)
|
.GroupBy(x => x.UserId)
|
||||||
.OrderByDescending(x => x.Sum(x => x.Count))
|
.OrderByDescending(x => x.Count()).ThenByDescending(x => x.Sum(x => x.Count))
|
||||||
.Skip(page * 10)
|
.Skip(page * 10)
|
||||||
.Take(10)
|
.Take(10)
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
UserId = x.Key,
|
UserId = x.Key,
|
||||||
Catches = x.Sum(x => x.Count)
|
Catches = x.Sum(x => x.Count),
|
||||||
|
Unique = x.Count()
|
||||||
})
|
})
|
||||||
.ToListAsyncLinqToDB()
|
.ToListAsyncLinqToDB()
|
||||||
.Fmap(x => x.Map(y => (y.UserId, y.Catches)));
|
.Fmap(x => x.Map(y => (y.UserId, y.Catches, y.Unique)).ToList());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,8 +235,14 @@ public partial class Games
|
||||||
? ud.ToString()
|
? ud.ToString()
|
||||||
: data.UserId.ToString();
|
: data.UserId.ToString();
|
||||||
|
|
||||||
|
var text =
|
||||||
|
$"""
|
||||||
|
{GetText(strs.fish_unique(Format.Bold(data.Unique.ToString())))}
|
||||||
|
*{GetText(strs.fish_catches(data.Catches))}*
|
||||||
|
""";
|
||||||
|
|
||||||
eb.AddField("#" + (page * 9 + i + 1) + " | " + user,
|
eb.AddField("#" + (page * 9 + i + 1) + " | " + user,
|
||||||
GetText(strs.fish_catches(Format.Bold(data.Catches.ToString()))),
|
text,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1260,5 +1260,6 @@
|
||||||
"fish_inv_title": "Fishing Inventory",
|
"fish_inv_title": "Fishing Inventory",
|
||||||
"fish_cant_uneq_potion": "You can't unequip a potion.",
|
"fish_cant_uneq_potion": "You can't unequip a potion.",
|
||||||
"fish_lb_title": "Fishing Leaderboard",
|
"fish_lb_title": "Fishing Leaderboard",
|
||||||
|
"fish_unique": "Caught {0} unique fish",
|
||||||
"fish_catches": "{0} catches"
|
"fish_catches": "{0} catches"
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue