Gerben321 / bike-care-tracker

Issue/Suggestion tracker for Bike Care app
3 stars 0 forks source link

Sorting, search and filtering on the Service schedule page #41

Closed Konstantin-Levin closed 1 month ago

Konstantin-Levin commented 2 months ago

The new sorting, search and filtering on the component page is great and it would be nice to have those features on the Service Schedule page as well.

Screenshot 2024-02-24 at 17 20 37

Obviously sorting is already possible on Title and Bike but being able to sort the entire list by the service % would be the most useful I think.

This would provide an visual representation of upcoming services for all bikes, making it easy for the user to plan their work.

The Dashboard page sort of does this already but only shows the component name and km/hrs reaming not the bike or title of service.

Screenshot 2024-02-24 at 17 55 27
Gerben321 commented 2 months ago

I think this is a good idea. However it's a bit more difficult than it sounds. In the table the 'next service' column is dynamically generated. This means that you can't simply sort it normally. The table currently is fetched from the background and all sorting is done with a new request to the server. I tell the database to sort by name, or bike, or whatever, but because the database has no direct idea of the next service, it is currently not possible.

A solution would be to 'cache' or aggregate the next service in the schedule directly. This way the database can sort by it. This however means that every action (like a new or updated ride, or edited schedule) can influence the next service, the percentage, etc etc. So I need to time to think that out and make sure it's flawless.

But what I'm doubting, how do we sort different types of schedules? How does an hour compare to 10km? There's the percentage that we have on all schedules, but then a problem is that 1% left on a 10.000km interval is a lot different than 1% left on a 10km interval.

What do you think?

Konstantin-Levin commented 2 months ago

Ah yes, sounds complicated. Not sure I'm afraid - I'm out of my depth here!

Gerben321 commented 2 months ago

Adding a percentage to sort in that aspect would be all you need, right? Because then I could calculate that every time you do a ride, do service, or change anything related to 'aggregate' that into a percentage in the database. That way you can simply sort by it.

Another approach would be to do a similar technique as with the bike components page where I load all data, and let you sort/filter it on your device which makes it really fast and snappy. But I'm not sure if that's overkill, unless you're looking for more complex filters etc.

Konstantin-Levin commented 2 months ago

I love the layout and sorting on the bike components page, so I think it would be great if you can replicate on the service page.

There would be some overlap in functionality between these two, but I think it's useful to retain the service schedule page as it shows services for all bikes and has useful information at a glance.

Gerben321 commented 2 months ago

So do you want something to see individual logs for a schedule? Or an alternative schedule overview page?

Konstantin-Levin commented 2 months ago

No I think the service schedule page is fine as it is. Just the ability to sort by upcoming service is what is missing

Gerben321 commented 2 months ago

Yeah right, so how do you imagine sorting that would work? As 2 rides left, or 5 days left, or 10 moving hours, or 300km aren't directly comparable. Should I try to put the percentage in the schedule and update that as good as possible so you can sort that way? Still won't be that accurate I'm afraid because 50% on 5000 km interval is different from 50% on a 50k km interval.

Konstantin-Levin commented 2 months ago

Yeah I think by percentage is the only way it is possible. I understand it's complicated trying to compare different variables like rides/days/hours/km. Perhaps it might not be useful if it can't be done well.

I think the average user would expect services that have been assigned the red alert status to be at the top, followed by yellow warning status, then green.

Gerben321 commented 2 months ago

That makes sense! I'll try to see if the percentage works.

Gerben321 commented 2 months ago

So here's an update on the ordering: image In this example I've ordered it from bad to good so to speak. It's using a hidden percentage field, but you use the status column for it.

As you might notice I've added a search field aswell. This searches through the name.

Next on the list is the filtering on (almost) overdue.

This is a quite big change as now the percentage is saved for every schedule, and that has to be updated with a few 'triggers' ofcourse. Like adding/editing a ride, adding/editing a schedule, and adding/editing/removing service logs. It seems to work fine, but needs good testing on your end aswell once it's ready to try.

Konstantin-Levin commented 2 months ago

This is great. Helpful for the user I think as they can see all the overdue services they need to do at the top of the page.

Reasonable to assume most people would want to carry multiple maintenance/service jobs in one go.

Gerben321 commented 2 months ago

I've added the filter as well. I think I'll deploy a first version for you to test. It might not be the final version, but I feel like it's good enough for now! Let me know what you think.

Konstantin-Levin commented 2 months ago

Nice. The filtering is helpful for sure.

A couple small things you may already know about:

I think the search box on this page only searches for the title of the service schedules? I think this is the right behaviour but could there be something like a greyed out text in the search box that says Service schedule title or whatever that disappears when the user starts typing? A small prompt and might prevent confusion if the user decides to try and search by bike or component name and nothing shows up.

Konstantin-Levin commented 2 months ago

Also visual difference when showing 10 schedules vs 25, 50 or 100.

Screenshot 2024-03-19 at 22 00 02 Screenshot 2024-03-19 at 21 59 53 Screenshot 2024-03-19 at 22 00 28

The show 10 is the better layout I think

Gerben321 commented 2 months ago

There isn't a difference in layout. The difference is in the content I think. After the 10th schedule there is some longer title which causes things to not fit anymore.

Gerben321 commented 2 months ago

Nice. The filtering is helpful for sure.

A couple small things you may already know about:

I think the search box on this page only searches for the title of the service schedules? I think this is the right behaviour but could there be something like a greyed out text in the search box that says Service schedule title or whatever that disappears when the user starts typing? A small prompt and might prevent confusion if the user decides to try and search by bike or component name and nothing shows up.

That might be a bit tricky but I'll see what I can do.

Gerben321 commented 1 month ago

I've done it even better! Searching now also goes through the bike and component! And the dropdown should be a bit nicer to look now. Let me know if there are things that should be better.