Gerben321 / bike-care-tracker

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

Swap components #66

Open OleksiyRudenko opened 1 month ago

OleksiyRudenko commented 1 month ago

Is your feature request related to a problem? Please describe. I may want to swap pedals (e.g. clipless and platform ones, based on the activity I am about to undertake).

Describe the solution you'd like I want to swap components of the same type with a single click, if there is any component of a specific type is already mounted. Then other unmounted components of the same type would offer a Swap button, clicking which would result in unmounting of the mounted component, and mounting the one the action is applied to. All magic with usage time perios would happen on BE. Please allow NFC/QR for the action per each component.

Describe alternatives you've considered Manully "unmounting" and "mounting" components.

Additional context n/a

Gerben321 commented 1 month ago

Would the NFC/QR option have a predetermined set of 2 components to swap between? So, it works like a toggle? So pedal A will be unmounted, and pedal B will be mounted. And next time the other way around?

How would this be set up? Some new menu item? Or at the component detail page?

I see something in my head like, you go to a special 'Swap components' page with a list of 'swaps'. A swap basically contains component A and component B. And they toggle their current status. They can be triggered with QR/NFC.

Only thing I am worried about is, what if you have a 'swap' set up, and both components end up either mounted or not mounted? So for example you manually both unmount or mount them. What would happen if you then want to execute the 'swap'? Sounds like it should throw an error for example. But I'm thinking edge cases now.

OleksiyRudenko commented 1 month ago

NFC/QR would be associated with a component X.

Action on scan:

component X on NFC/QR is: another component (Y) of the same type is mounted no components of same type mounted
mounted NOT POSSIBLE, error (if X!=Y) or confirm X is already mounted (if X==Y) just unmount X, maybe ask for action confirmation, as no components will be mounted past action
unmounted unmount Y, then mount X just mount X
Gerben321 commented 1 month ago

What if there are more than 2 types of components? Like you have 3 wheelsets? An indoor trainer set, gravel set, race set, etc. I'm just thinking usecases here.

OleksiyRudenko commented 1 month ago

What if there are more than 2 types of components? Like you have 3 wheelsets? An indoor trainer set, gravel set, race set, etc. I'm just thinking usecases here.

Not really a problem. You may have only one component of the same type mounted at any given point of time, and you cannot really scan several NFCs/QRs simultaneously.

You do not need to have component Y encoded on NFC/QR. BE already "knows" if there is any component of given type mounted and what is its id.

OleksiyRudenko commented 1 month ago

However, if one has 2+ frames where a, say, wheelset can be mounted on this is yet to solve. I can see two options here: (1) encode frame id on NFC/QR (2) if no frame id encoded (actually suggest a code with no frame id) then response page would ask what frame to apply the component to.

Gerben321 commented 1 month ago

Oh, right I get what you mean. I was thinking one NFC/QR endpoint would both unmount component X and mount component Y. But you mean there's one endpoint per component, which either mounts or unmounts the component you selected?

I'm not sure that I want to enforce the 'only x components at the same time of a type'. That might be a bit more complicated than it sounds. But it might help in this use case to prevent accidentally mounting or unmounting something while another component is already mounted as well.

OleksiyRudenko commented 1 month ago

Are front wheel and rear wheel the same type? If not you're all good. Are right and left pedals the same type? If not then not so good :)

OleksiyRudenko commented 1 month ago

I'm not sure that I want to enforce the 'only x components at the same time of a type'. That might be a bit more complicated than it sounds.

I know nothing about BikeCare's BE data schema but seemingly an extra condition check could be wrapped in the same transaction with the record update.

Gerben321 commented 1 month ago

Yeah I might have spoken a bit early. Shouldn't be too complicated. I didn't want to enforce it at the beginning, but on the other hand it can help the user track down errors in their input.

But we have to make sure every type of component is separated in a front/rear or left/right type. Because otherwise we can get problems when we enforce the limit of 1 component of a type active per bike.

Gerben321 commented 1 month ago

Are front wheel and rear wheel the same type? If not you're all good. Are right and left pedals the same type? If not then not so good :)

Just to get this right before I start on it: You can have as many components to a bike, right? For example, 2 chains, 2 front wheels, 2 rear wheels. But only 1 can be active, right?

So, the constraint/check shouldn't be in a component itself, but in the usage period that you add or edit. Correct?

OleksiyRudenko commented 1 month ago

Yes, I guess so.

With the only exception being that I may have more than 2 interchangeable components, for e.g. 3 sets of wheels (2 different surface conditions + 1 spare pair).

Gerben321 commented 1 month ago

Yeah it doesn't matter how many components there are, but you can only have one type active at the same time. I think I can just edit the current check where it tells you you can't have overlapping usage periods. The change would be to check on component type instead of specific component.