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

feat(app): Show all labware of same type as confirmed #2525

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/robot/selectors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
// robot selectors
import padStart from 'lodash/padStart'
import some from 'lodash/some'
import {createSelector} from 'reselect'

import {
Expand Down Expand Up @@ -306,7 +307,16 @@ export const getLabware = createSelector(
.filter(isSlot)
.map((slot) => {
const labware = lwBySlot[slot]
const confirmed = confirmedBySlot[slot] || false
const {type, isTiprack} = labware

// labware is confirmed if:
// - tiprack: labware in slot is confirmed
// - non-tiprack: labware in slot or any of same type is confirmed
const confirmed = some(confirmedBySlot, (value, key) => (
value === true &&
(key === slot || (!isTiprack && type === lwBySlot[key].type))
))

let calibration: LabwareCalibrationStatus = 'unconfirmed'
let isMoving = false

Expand Down
11 changes: 11 additions & 0 deletions app/src/robot/test/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ describe('robot selectors', () => {
calibratorMount: 'left',
},
5: {slot: '5', type: 'a', isTiprack: false},
7: {slot: '7', type: 'a', isTiprack: false},
9: {slot: '9', type: 'b', isTiprack: false},
},
pipettesByMount: {
Expand Down Expand Up @@ -591,6 +592,16 @@ describe('robot selectors', () => {
calibration: 'unconfirmed',
confirmed: true,
},
// then other labware by slot
{
slot: '7',
type: 'a',
isTiprack: false,
isMoving: false,
calibration: 'unconfirmed',
// note: labware a in slot 7 is confirmed because confirmed in slot 5
confirmed: true,
},
{
slot: '9',
type: 'b',
Expand Down