Skip to content

Commit

Permalink
do not backfill selected wells in edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Oct 9, 2024
1 parent b363e78 commit a7a5977
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion shared-data/js/helpers/__tests__/wellSets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ describe('getWellSetForMultichannel with pipetteNozzleDetails', () => {
activeNozzleCount: 4,
},
})
expect(bottomEdgeResult).toEqual(['E1', 'F1', 'G1', 'H1'])
expect(bottomEdgeResult).toEqual(['G1', 'H1'])
})

it('returns full plate for 96-channel pipette with no config', () => {
Expand Down
15 changes: 2 additions & 13 deletions shared-data/js/helpers/wellSets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,9 @@ export const makeWellSetHelpers = (): WellSetHelpers => {
}

const wellIndex = targetColumn.indexOf(wellName)
const totalWells = targetColumn.length

if (activeNozzleCount >= totalWells) {
return targetColumn
}

// Calculate how many wells we can include below the selected well, handling edge cases.
const wellsBelow = totalWells - wellIndex - 1
const wellsNeededAbove = Math.max(0, activeNozzleCount - wellsBelow - 1)

const startIndex = Math.max(0, wellIndex - wellsNeededAbove)
const endIndex = Math.min(totalWells, startIndex + activeNozzleCount)

return targetColumn.slice(startIndex, endIndex)
// If there are fewer wells than active nozzles, only select as many wells as there are nozzles.
return targetColumn.slice(wellIndex, wellIndex + activeNozzleCount)
}

if (channels === 8) {
Expand Down

0 comments on commit a7a5977

Please sign in to comment.