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

Improve how time balance is calculated #306

Open
sauloperez opened this issue Jan 30, 2018 · 1 comment
Open

Improve how time balance is calculated #306

sauloperez opened this issue Jan 30, 2018 · 1 comment

Comments

@sauloperez
Copy link
Collaborator

After merging #305, all balances displayed in the app are calculated with a mix of #seconds_to_hm plus some conditional logic. This is not as readable as a call to a #time_balance method would be.

Moreover, this is something would be better off done by postgres: balance * interval '1 sec'. I did a bit of investigation some days ago and I didn't find a way to do this through ActiveRecord. I'd be good to give it another look, because it seems like the optimal solution.

If that is indeed not possible, we need to implement a #time_balance that at least hides the complexity of the current calculation.

@mperezv mperezv self-assigned this Mar 10, 2020
@mperezv
Copy link
Collaborator

mperezv commented Mar 10, 2020

I'm going to try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants