From a32599cbdeeca7d18f148eb7931c2c28cb50e7f5 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 29 Jun 2016 12:48:04 +0100 Subject: [PATCH] Fixed a timing bug found the in build. Note, when working with time differences use TotalDays. --- PlexRequests.Services.Tests/UserRequestLimitResetterTests.cs | 1 + PlexRequests.Services/Jobs/UserRequestLimitResetter.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PlexRequests.Services.Tests/UserRequestLimitResetterTests.cs b/PlexRequests.Services.Tests/UserRequestLimitResetterTests.cs index 729169b7b..be437c7fe 100644 --- a/PlexRequests.Services.Tests/UserRequestLimitResetterTests.cs +++ b/PlexRequests.Services.Tests/UserRequestLimitResetterTests.cs @@ -115,6 +115,7 @@ namespace PlexRequests.Services.Tests private static readonly IEnumerable DoNotResetData = new List { new TestCaseData(1, RequestType.Movie).SetName("1 Day(s)"), + new TestCaseData(100, RequestType.Movie).SetName("100 Day(s)"), new TestCaseData(-6, RequestType.TvShow).SetName("-6 Day(s)"), new TestCaseData(-1, RequestType.TvShow).SetName("-1 Day(s)"), new TestCaseData(-2, RequestType.Album).SetName("-2 Day(s)"), diff --git a/PlexRequests.Services/Jobs/UserRequestLimitResetter.cs b/PlexRequests.Services/Jobs/UserRequestLimitResetter.cs index 14acd17bc..96d613b72 100644 --- a/PlexRequests.Services/Jobs/UserRequestLimitResetter.cs +++ b/PlexRequests.Services/Jobs/UserRequestLimitResetter.cs @@ -88,7 +88,7 @@ namespace PlexRequests.Services.Jobs var users = allUsers.Where(x => x.RequestType == type); foreach (var u in users) { - var daysDiff = (u.FirstRequestDate - DateTime.UtcNow.AddDays(-7)).Days; + var daysDiff = (u.FirstRequestDate - DateTime.UtcNow.AddDays(-7)).TotalDays; if (daysDiff <= 0) { Repo.Delete(u);