fix timespan when removing no-fronters
This commit is contained in:
parent
0dfea56d83
commit
bc32943824
@ -352,9 +352,11 @@ namespace PluralKit.Bot {
|
|||||||
embedColor = DiscordUtils.Gray;
|
embedColor = DiscordUtils.Gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actualPeriod = breakdown.RangeEnd - breakdown.RangeStart;
|
var period = breakdown.RangeEnd - breakdown.RangeStart;
|
||||||
// this is kinda messy?
|
var actualPeriod = period;
|
||||||
var hasFrontersPeriod = Duration.FromTicks(breakdown.MemberSwitchDurations.Values.ToList().Sum(i => i.TotalTicks));
|
|
||||||
|
if (ignoreNoFronters)
|
||||||
|
period = period - breakdown.NoFronterDuration;
|
||||||
|
|
||||||
var eb = new EmbedBuilder()
|
var eb = new EmbedBuilder()
|
||||||
.Title(embedTitle)
|
.Title(embedTitle)
|
||||||
@ -371,7 +373,7 @@ namespace PluralKit.Bot {
|
|||||||
var membersOrdered = pairs.OrderByDescending(pair => pair.Value).Take(maxEntriesToDisplay).ToList();
|
var membersOrdered = pairs.OrderByDescending(pair => pair.Value).Take(maxEntriesToDisplay).ToList();
|
||||||
foreach (var pair in membersOrdered)
|
foreach (var pair in membersOrdered)
|
||||||
{
|
{
|
||||||
var frac = pair.Value / (ignoreNoFronters ? hasFrontersPeriod : actualPeriod);
|
var frac = pair.Value / period;
|
||||||
eb.Field(new(pair.Key?.NameFor(ctx) ?? "*(no fronter)*", $"{frac*100:F0}% ({pair.Value.FormatDuration()})"));
|
eb.Field(new(pair.Key?.NameFor(ctx) ?? "*(no fronter)*", $"{frac*100:F0}% ({pair.Value.FormatDuration()})"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user