Skip to content

Commit ac4d8cb

Browse files
committed
revert badge rarity calculation to go back to when gen2 was added
1 parent 322dfc8 commit ac4d8cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

TPP.Persistence.MongoDB/Repos/BadgeRepo.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public class BadgeRepo(
3333
public readonly IMongoCollection<Badge> Collection = database.GetCollection<Badge>(CollectionName);
3434
public readonly IMongoCollection<BadgeStat> CollectionStats = database.GetCollection<BadgeStat>(CollectionNameStats);
3535

36+
private static readonly Instant WhenGen2WasAddedToPinball = Instant.FromUtc(2018, 3, 28, 12, 00);
37+
/// Instant at which some update was deployed that is expected to majorly disrupt badge rarities,
38+
/// e.g. if a whole new generation was added to pinball.
39+
private static readonly Instant LastRarityUpdate = WhenGen2WasAddedToPinball;
40+
3641
/// Pinball drops enough badges that a somewhat small time-span is already statistically significant.
3742
/// Also, if Pinball ever gets tweaked and natural drop chances change, ignoring old badges gradually
3843
/// transitions to the new rarities.
@@ -248,7 +253,7 @@ public async Task RenewBadgeStats(IImmutableSet<PkmnSpecies>? onlyTheseSpecies =
248253
{
249254
var stopwatch = Stopwatch.StartNew();
250255
Instant now = clock.GetCurrentInstant();
251-
Instant startTime = now - _rarityCalculationTransition;
256+
Instant startTime = Instant.Min(LastRarityUpdate, now - _rarityCalculationTransition);
252257

253258
IAggregateFluent<Badge> pipeline = Collection.Aggregate(new AggregateOptions { AllowDiskUse = true });
254259
if (onlyTheseSpecies != null)

0 commit comments

Comments
 (0)