diff --git a/src/PrayerTracker.Data/Entities.fs b/src/PrayerTracker.Data/Entities.fs index 442e974..6718779 100644 --- a/src/PrayerTracker.Data/Entities.fs +++ b/src/PrayerTracker.Data/Entities.fs @@ -545,13 +545,13 @@ and [] PrayerRequest = match this.requestType with | LongTermRequest | Expecting -> false - | _ -> curr.AddDays(-(float expDays)) > this.updatedDate // Automatic expiration + | _ -> curr.AddDays(-(float expDays)).Date > this.updatedDate.Date // Automatic expiration /// Is an update required for this long-term request? member this.updateRequired curr expDays updWeeks = match this.isExpired curr expDays with | true -> false - | false -> curr.AddDays(-(float (updWeeks * 7))) > this.updatedDate + | false -> curr.AddDays(-(float (updWeeks * 7))).Date > this.updatedDate.Date /// Configure EF for this entity static member internal configureEF (mb : ModelBuilder) = diff --git a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj index da602fa..6dd443d 100644 --- a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj +++ b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj @@ -2,9 +2,9 @@ netstandard2.0 - 7.3.1.0 - 7.3.1.0 - 7.3.1 + 7.3.2.0 + 7.3.2.0 + 7.3.2 diff --git a/src/PrayerTracker.Tests/Data/EntitiesTests.fs b/src/PrayerTracker.Tests/Data/EntitiesTests.fs index d6bf322..28f6185 100644 --- a/src/PrayerTracker.Tests/Data/EntitiesTests.fs +++ b/src/PrayerTracker.Tests/Data/EntitiesTests.fs @@ -171,33 +171,42 @@ let prayerRequestTests = Expect.isTrue (req.isExpired DateTime.Now 5) "A force-expired request should always be considered expired" } test "isExpired returns false for non-expired requests" { - let req = { PrayerRequest.empty with updatedDate = DateTime.Now.AddDays -5. } - Expect.isFalse (req.isExpired DateTime.Now 7) "A request updated 5 days ago should not be considered expired" + let now = DateTime.Now + let req = { PrayerRequest.empty with updatedDate = now.AddDays -5. } + Expect.isFalse (req.isExpired now 7) "A request updated 5 days ago should not be considered expired" } test "isExpired returns true for expired requests" { - let req = { PrayerRequest.empty with updatedDate = DateTime.Now.AddDays -8. } - Expect.isTrue (req.isExpired DateTime.Now 7) "A request updated 8 days ago should be considered expired" + let now = DateTime.Now + let req = { PrayerRequest.empty with updatedDate = now.AddDays -8. } + Expect.isTrue (req.isExpired now 7) "A request updated 8 days ago should be considered expired" + } + test "isExpired returns true for same-day expired requests" { + let now = DateTime.Now + let req = { PrayerRequest.empty with updatedDate = now.Date.AddDays(-7.).AddSeconds -1. } + Expect.isTrue (req.isExpired now 7) "A request entered a second before midnight should be considered expired" } test "updateRequired returns false for expired requests" { let req = { PrayerRequest.empty with expiration = Forced } Expect.isFalse (req.updateRequired DateTime.Now 7 4) "An expired request should not require an update" } test "updateRequired returns false when an update is not required for an active request" { + let now = DateTime.Now let req = { PrayerRequest.empty with requestType = LongTermRequest - updatedDate = DateTime.Now.AddDays -14. + updatedDate = now.AddDays -14. } - Expect.isFalse (req.updateRequired DateTime.Now 7 4) + Expect.isFalse (req.updateRequired now 7 4) "An active request updated 14 days ago should not require an update until 28 days" } test "updateRequired returns true when an update is required for an active request" { + let now = DateTime.Now let req = { PrayerRequest.empty with requestType = LongTermRequest - updatedDate = DateTime.Now.AddDays -34. + updatedDate = now.AddDays -34. } - Expect.isTrue (req.updateRequired DateTime.Now 7 4) + Expect.isTrue (req.updateRequired now 7 4) "An active request updated 34 days ago should require an update (past 28 days)" } ] diff --git a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj index 906d3ca..6fcfc9e 100644 --- a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj +++ b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj @@ -3,9 +3,9 @@ Exe netcoreapp2.2 - 7.3.1.0 - 7.3.1.0 - 7.3.1 + 7.3.2.0 + 7.3.2.0 + 7.3.2 diff --git a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj index e927bb9..981eaf1 100644 --- a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj +++ b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj @@ -2,9 +2,9 @@ netstandard2.0 - 7.3.1.0 - 7.3.1.0 - 7.3.1 + 7.3.2.0 + 7.3.2.0 + 7.3.2 diff --git a/src/PrayerTracker/App.fs b/src/PrayerTracker/App.fs index ffb5937..51f8259 100644 --- a/src/PrayerTracker/App.fs +++ b/src/PrayerTracker/App.fs @@ -55,7 +55,7 @@ module Configure = CookieCrypto (crypto.["Key"], crypto.["IV"]) |> setCrypto svc.AddDbContext( fun options -> - options.UseNpgsql(config.GetConnectionString "PrayerTracker") |> ignore) + options.UseNpgsql (config.GetConnectionString "PrayerTracker") |> ignore) |> ignore /// Routes for PrayerTracker diff --git a/src/PrayerTracker/PrayerTracker.fsproj b/src/PrayerTracker/PrayerTracker.fsproj index 4e75466..085722f 100644 --- a/src/PrayerTracker/PrayerTracker.fsproj +++ b/src/PrayerTracker/PrayerTracker.fsproj @@ -2,11 +2,11 @@ netcoreapp2.2 - 7.3.1.0 - 7.3.1.0 + 7.3.2.0 + 7.3.2.0 Bit Badger Solutions - 7.3.1 + 7.3.2