beeminder / BeeSwift

Official Beeminder for iOS app
Other
30 stars 6 forks source link

using ``Daystamp`` when considering deadline #510

Closed krugerk closed 1 week ago

krugerk commented 2 weeks ago

Daystamp contains the logic for calculating the date (all of year, month, and day) that should be reported as the daystamp of a newly created datapoint, including accounting for the goal's deadline.

This merge request uses Daystamp and this feature of it to replace the three instances of other areas in the app tackling this same calculation: in Today View extension, in Goal / add datapoint, and in Timer.

Furthermore, three places with their own implementations all suffered the same logic error of not accounting for certain deadlines correctly - in particular deadlines just after midnight (midnight until 1 in the morning):

 if self.goal.deadline > 0 && currentHour! < 6 && currentHour! < self.goal.deadline/3600 {
            self.dateStepper.value = -1
        }

If there was not a whole hour of difference, then the deadline was effectively ignored.

Fixes #17 Fixes #228

-- There have been many reports of the app not handling deadlines well or properly. Commit 5f3278c6f9a2d6fef21d63d7288739d31c81d1d3 introduces logic for handling the deadline in the Goal/add and Timer screens. Other, possibly related issues: #17, #35, #228, #450