Skip to content

Commit

Permalink
fix age in days to count the starting day
Browse files Browse the repository at this point in the history
  • Loading branch information
laimis committed May 7, 2024
1 parent a8d9423 commit 67677a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/StockScreenerReports.Core/Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -476,5 +476,5 @@ type IndustrySequence = {
member this.start = this.values |> List.last
member this.end' = this.values.Head
member this.length = this.values.Length
member this.age = this.end'.date - this.start.date
member this.ageInDays = this.age.TotalDays |> Math.Floor |> int
member private this.age = this.end'.date - this.start.date
member this.ageInDays = this.age.TotalDays |> Math.Floor |> int |> (+) 1
2 changes: 1 addition & 1 deletion tests/IndustryTrendsCalculatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ type IndustryTrendsCalculatorTests(output:ITestOutputHelper) =
underTest.start.date.Date |> should equal expectedStart
underTest.end'.value |> should be (greaterThanOrEqualTo 90)
underTest.end'.date.Date |> should equal expectedEnd
underTest.age.TotalDays |> int |> should equal 6
underTest.ageInDays |> int |> should equal 7
underTest.length |> should equal 7
underTest.open' |> should be False
underTest.values |> List.forall (fun x -> x.value >= 90m) |> should be True
Expand Down

0 comments on commit 67677a2

Please sign in to comment.