Merge branch 'master' into issue-13
This commit is contained in:
commit
da134318d8
|
@ -545,13 +545,13 @@ and [<CLIMutable; NoComparison; NoEquality>] 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) =
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AssemblyVersion>7.3.1.0</AssemblyVersion>
|
||||
<FileVersion>7.3.1.0</FileVersion>
|
||||
<Version>7.3.1</Version>
|
||||
<AssemblyVersion>7.3.2.0</AssemblyVersion>
|
||||
<FileVersion>7.3.2.0</FileVersion>
|
||||
<Version>7.3.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -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)"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyVersion>7.3.1.0</AssemblyVersion>
|
||||
<FileVersion>7.3.1.0</FileVersion>
|
||||
<Version>7.3.1</Version>
|
||||
<AssemblyVersion>7.3.2.0</AssemblyVersion>
|
||||
<FileVersion>7.3.2.0</FileVersion>
|
||||
<Version>7.3.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AssemblyVersion>7.3.1.0</AssemblyVersion>
|
||||
<FileVersion>7.3.1.0</FileVersion>
|
||||
<Version>7.3.1</Version>
|
||||
<AssemblyVersion>7.3.2.0</AssemblyVersion>
|
||||
<FileVersion>7.3.2.0</FileVersion>
|
||||
<Version>7.3.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -55,7 +55,7 @@ module Configure =
|
|||
CookieCrypto (crypto.["Key"], crypto.["IV"]) |> setCrypto
|
||||
svc.AddDbContext<AppDbContext>(
|
||||
fun options ->
|
||||
options.UseNpgsql(config.GetConnectionString "PrayerTracker") |> ignore)
|
||||
options.UseNpgsql (config.GetConnectionString "PrayerTracker") |> ignore)
|
||||
|> ignore
|
||||
|
||||
/// Routes for PrayerTracker
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyVersion>7.3.1.0</AssemblyVersion>
|
||||
<FileVersion>7.3.1.0</FileVersion>
|
||||
<AssemblyVersion>7.3.2.0</AssemblyVersion>
|
||||
<FileVersion>7.3.2.0</FileVersion>
|
||||
<Authors></Authors>
|
||||
<Company>Bit Badger Solutions</Company>
|
||||
<Version>7.3.1</Version>
|
||||
<Version>7.3.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue
Block a user