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

Swap components #66

Open
OleksiyRudenko opened this issue Mar 25, 2024 · 12 comments
Open

Swap components #66

OleksiyRudenko opened this issue Mar 25, 2024 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@OleksiyRudenko
Copy link

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 Gerben321 self-assigned this Mar 25, 2024
@Gerben321 Gerben321 added the enhancement New feature or request label Mar 25, 2024
@Gerben321
Copy link
Owner

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
Copy link
Author

OleksiyRudenko commented Mar 25, 2024

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
Copy link
Owner

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
Copy link
Author

OleksiyRudenko commented Mar 25, 2024

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants