Skip to content

Commit

Permalink
Fixed project usage stats
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Nov 29, 2023
1 parent 5fd9c0d commit 20e0263
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Exceptionless.Core/Extensions/ProjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ public static void TrimUsage(this Project project)
// keep 1 year of usage
project.Usage = project.Usage.Except(project.Usage
.Where(u => SystemClock.UtcNow.Subtract(u.Date) > TimeSpan.FromDays(366)))
.OrderBy(u => u.Date)
.ToList();

// keep 30 days of hourly usage that have blocked events, otherwise keep it for 7 days
project.UsageHours = project.UsageHours.Except(project.UsageHours
.Where(u => SystemClock.UtcNow.Subtract(u.Date) > TimeSpan.FromDays(u.Blocked > 0 ? 30 : 7)))
.OrderBy(u => u.Date)
.ToList();
}

Expand Down

0 comments on commit 20e0263

Please sign in to comment.