Fix start timer service when only one vial installed & add additional check if specific slot is selected #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, if no slot is specified, the
start_timer
service will automatically selectslot 2
if a user only has one vial installed (in particular inslot 1
). A Pura device that only has a vial inslot 1
will return abay2
wearingTime
of0
. As a result, if thewearingTime
forbay1
is greater than0
,slot 2
will be the automatically selected slot instead ofslot 1
even though no fragrance vial is installed inbay2
.Example data returned by Pura API when only
bay1
slot has a fragrance vial:In order to get around this, if a user hasn't selected a slot:
installed_slots
list.bay1
andbay2
are occupied, then we comparewearingTime
bay1
orbay2
has a vial installed, then whichever one has a vial is determined to be the automatically selected slot.start_timer
on the device that has no vials installed.If a user selects a specific slot:
An exception is raised indicating that the selected slot doesn't have a vial installed if the slot is not found in the
installed_slots
list.