mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
duration can be passed as null from the parser so handle that in frontpercent
This commit is contained in:
parent
271ea9c27b
commit
25bf0d85d4
1 changed files with 4 additions and 1 deletions
|
|
@ -104,7 +104,7 @@ public class SystemFront
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task FrontPercent(Context ctx, PKSystem? system = null, string durationStr = "30d", bool ignoreNoFronters = false, bool showFlat = false, PKGroup? group = null)
|
public async Task FrontPercent(Context ctx, PKSystem? system, string? durationStr, bool ignoreNoFronters = false, bool showFlat = false, PKGroup? group = null)
|
||||||
{
|
{
|
||||||
if (system == null && group == null) throw Errors.NoSystemError(ctx.DefaultPrefix);
|
if (system == null && group == null) throw Errors.NoSystemError(ctx.DefaultPrefix);
|
||||||
if (system == null) system = await GetGroupSystem(ctx, group);
|
if (system == null) system = await GetGroupSystem(ctx, group);
|
||||||
|
|
@ -114,6 +114,9 @@ public class SystemFront
|
||||||
var totalSwitches = await ctx.Repository.GetSwitchCount(system.Id);
|
var totalSwitches = await ctx.Repository.GetSwitchCount(system.Id);
|
||||||
if (totalSwitches == 0) throw Errors.NoRegisteredSwitches;
|
if (totalSwitches == 0) throw Errors.NoRegisteredSwitches;
|
||||||
|
|
||||||
|
if (durationStr == null)
|
||||||
|
durationStr = "30d";
|
||||||
|
|
||||||
// Picked the UNIX epoch as a random date
|
// Picked the UNIX epoch as a random date
|
||||||
// even though we don't store switch timestamps in UNIX time
|
// even though we don't store switch timestamps in UNIX time
|
||||||
// I assume most people won't have switches logged previously to that (?)
|
// I assume most people won't have switches logged previously to that (?)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue