Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minutes vs hours with the built-in timer #290

Open
dreeves opened this issue Mar 17, 2022 · 1 comment
Open

Minutes vs hours with the built-in timer #290

dreeves opened this issue Mar 17, 2022 · 1 comment
Labels
BUG Opposite of feature RFE Request For Enhancement aka feature request UVI Will count as a User-Visible Improvement

Comments

@dreeves
Copy link
Member

dreeves commented Mar 17, 2022

I'm not sure yet if this is a BeemiOS thing or a serverside thing but we got this very sensible feedback / bug report from a user:

Could we make the timer in the iOS app input in minutes rather than something like fraction of a whole day [probably they meant hours]?

image

The Beedroid timer only does hours (which might be correct and if so it needs to be enforced to avoid confusion, but that's a separate can of worms) but it does display timey goals correctly as HH:MM.

Cognata

  • The H.M.S. Parsafore

Verbata: HMS format, hours vs minutes for the timer, floating point hell,

@dreeves dreeves added BUG Opposite of feature RFE Request For Enhancement aka feature request UVI Will count as a User-Visible Improvement labels Mar 17, 2022
@krugerk
Copy link
Contributor

krugerk commented Oct 29, 2024

As is, the timer tracks accumulated seconds. The app contains some logic for treating a goal's units as either minutes or hours:

let hoursRegex = try NSRegularExpression(pattern: "(hr|hour)s?")
let minutesRegex = try NSRegularExpression(pattern: "(min|minute)s?")
if hoursRegex.firstMatch(in: self.goal.yAxis, options: [], range: NSMakeRange(0, self.goal.yAxis.count)) != nil {
controller.units = "hours"
}
if minutesRegex.firstMatch(in: self.goal.yAxis, options: [], range: NSMakeRange(0, self.goal.yAxis.count)) != nil {
controller.units = "minutes"
}

When submitting to the Beeminder server/backend, the seconds are converted to a decimal number representing either number of minutes or, the default, number of hours:

var value = self.totalSeconds()/3600.0
if self.units == "minutes" { value = self.totalSeconds()/60.0 }

From the looks of it, the Edit Datapoint VC merely displays the decimal number in a datapoint's value (and does not format it in hour:minute:second):

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

The section showing the recent datapoints, however, does account for a goal's hhmm setting and uses the format hour:minute in that case:

if hhmmformat {
let value = datapoint.value.doubleValue
let hours = Int(value)
let minutes = Int(value.truncatingRemainder(dividingBy: 1) * 60)
formattedValue = String(hours) + ":" + String(format: "%02d", minutes)
} else {
formattedValue = datapoint.value.stringValue
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Opposite of feature RFE Request For Enhancement aka feature request UVI Will count as a User-Visible Improvement
Projects
None yet
Development

No branches or pull requests

2 participants