AlfHou / hammond

Self hosted vehicle and expense management system. Like Clarkson, but better
GNU Affero General Public License v3.0
139 stars 19 forks source link

Fillings are out of order when there are multiple fillings per day #84

Open vKnmnn opened 1 year ago

vKnmnn commented 1 year ago

this is on the vehigcle detail page. i'd suggest adding more granularity by making a proper datetime value for a filling and sorting by it, or just sort by odometer

alienp4nda commented 10 months ago

@AlfHou how would you want to handle this?

It looks like time is ignored in fillups.

https://github.com/AlfHou/hammond/blob/dd1d646a8af8f97e57ea8ecae4628b4770b6e8be/ui/src/router/views/createFillup.vue#L87

https://github.com/AlfHou/hammond/blob/dd1d646a8af8f97e57ea8ecae4628b4770b6e8be/server/models/vehicle.go#L54

Sorting by odometer doesn't seem to be much of a change. We'd just need to add , odoReading to the Order for each one of these lines that queries for fillups from the database in server/db/dbModels.go.

I haven't tested it out, just what I see from a quick glance.

AlfHou commented 10 months ago

@alienp4nda I seem to recall having fixed this in the original Hammond project, but seems like the fix didn't work I guess. I think we can try using the time as well to get the correct order.

Here was my original PR: https://github.com/akhilrex/hammond/pull/77

alienp4nda commented 10 months ago

We can use time, we’ll just have to change front end and backend to actually have time.

vKnmnn commented 9 months ago

is it possible that this affects the calculation of L/100km for graph creation? Out of order entries may cause negative or wrong values.

alienp4nda commented 9 months ago

Possibly, I have a fix that I haven't merged yet for the out of order fillups.