Skip to content

Commit 1f769c3

Browse files
committed
getVisualSlotIdFromAAId
1 parent 00841d4 commit 1f769c3

File tree

2 files changed

+52
-86
lines changed

2 files changed

+52
-86
lines changed

shared-data/js/__tests__/fixtures.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
getFlexDeckDefAAByFixtureIdForCutoutId,
2727
getReplacementFixtureForFakeFixture,
2828
getReplacementFixtureForFixtureRemoval,
29+
getVisualSlotIdFromAAId,
2930
isFixtureInUsbModules,
3031
replaceAAWithFakeAA,
3132
replaceCutoutFixtureRemove,
@@ -533,3 +534,15 @@ describe('isFixtureInModules', () => {
533534
expect(result).toEqual(false)
534535
})
535536
})
537+
538+
describe('getVisualSlotIdFromAAId', () => {
539+
it('should get VSD4 for flexStackerModuleV1D4', () => {
540+
const vs = getVisualSlotIdFromAAId('flexStackerModuleV1D4')
541+
expect(vs).toEqual('VSD4')
542+
})
543+
544+
it('should get VSD3 for D3', () => {
545+
const vs = getVisualSlotIdFromAAId('D3')
546+
expect(vs).toEqual('VSD3')
547+
})
548+
})

shared-data/js/fixtures.ts

Lines changed: 39 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -855,95 +855,48 @@ export const STANDARD_FLEX_SLOTS: AddressableAreaName[] = [
855855
D3_ADDRESSABLE_AREA,
856856
]
857857

858-
export type VISUAL_SLOTS =
859-
| 'VSA1'
860-
| 'VSB1'
861-
| 'VSC1'
862-
| 'VSD1'
863-
| 'VSA2'
864-
| 'VSB2'
865-
| 'VSC2'
866-
| 'VSD2'
867-
| 'VSA3'
868-
| 'VSB3'
869-
| 'VSC3'
870-
| 'VSD3'
871-
| 'VSA4'
872-
| 'VSB4'
873-
| 'VSC4'
874-
| 'VSD4'
858+
export type VISUAL_SLOTS =
859+
'VSA1'
860+
| 'VSB1'
861+
| 'VSC1'
862+
| 'VSD1'
863+
| 'VSA2'
864+
| 'VSB2'
865+
| 'VSC2'
866+
| 'VSD2'
867+
| 'VSA3'
868+
| 'VSB3'
869+
| 'VSC3'
870+
| 'VSD3'
871+
| 'VSA4'
872+
| 'VSB4'
873+
| 'VSC4'
874+
| 'VSD4'
875875

876876
export const VS_TO_AA: Record<VISUAL_SLOTS, AddressableAreaNamesWithFakes[]> = {
877-
VSA1: [
878-
'A1',
879-
'magneticBlockV1A1',
880-
'temperatureModuleV2A1',
881-
'heaterShakerV1A1',
882-
'movableTrashA1',
883-
],
884-
VSB1: [
885-
'B1',
886-
'magneticBlockV1B1',
887-
'temperatureModuleV2B1',
888-
'heaterShakerV1B1',
889-
'movableTrashB1',
890-
],
891-
VSC1: [
892-
'C1',
893-
'magneticBlockV1C1',
894-
'temperatureModuleV2C1',
895-
'heaterShakerV1C1',
896-
'movableTrashC1',
897-
],
898-
VSD1: [
899-
'D1',
900-
'magneticBlockV1D1',
901-
'temperatureModuleV2D1',
902-
'heaterShakerV1D1',
903-
'movableTrashD1',
904-
],
877+
VSA1: ['A1', 'magneticBlockV1A1', 'temperatureModuleV2A1', 'heaterShakerV1A1', 'movableTrashA1'],
878+
VSB1: ['B1', 'magneticBlockV1B1', 'temperatureModuleV2B1', 'heaterShakerV1B1', 'movableTrashB1'],
879+
VSC1: ['C1', 'magneticBlockV1C1', 'temperatureModuleV2C1', 'heaterShakerV1C1', 'movableTrashC1'],
880+
VSD1: ['D1', 'magneticBlockV1D1', 'temperatureModuleV2D1', 'heaterShakerV1D1', 'movableTrashD1'],
905881
VSA2: ['A2', 'magneticBlockV1A2'],
906882
VSB2: ['B2', 'magneticBlockV1B2'],
907883
VSC2: ['C2', 'magneticBlockV1C2'],
908884
VSD2: ['D2', 'magneticBlockV1D2'],
909-
VSA3: [
910-
'A3',
911-
'magneticBlockV1A3',
912-
'temperatureModuleV2A3',
913-
'heaterShakerV1A3',
914-
'movableTrashA3',
915-
],
916-
VSB3: [
917-
'B3',
918-
'magneticBlockV1B3',
919-
'temperatureModuleV2B3',
920-
'heaterShakerV1B3',
921-
'movableTrashB3',
922-
],
923-
VSC3: [
924-
'C3',
925-
'magneticBlockV1C3',
926-
'temperatureModuleV2C3',
927-
'heaterShakerV1C3',
928-
'movableTrashC3',
929-
],
930-
VSD3: [
931-
'D3',
932-
'magneticBlockV1D3',
933-
'temperatureModuleV2D3',
934-
'heaterShakerV1D3',
935-
'movableTrashD3',
936-
'96ChannelWasteChute',
937-
'1ChannelWasteChute',
938-
'8ChannelWasteChute',
939-
'gripperWasteChute',
940-
],
885+
VSA3: ['A3', 'magneticBlockV1A3', 'temperatureModuleV2A3', 'heaterShakerV1A3', 'movableTrashA3'],
886+
VSB3: ['B3', 'magneticBlockV1B3', 'temperatureModuleV2B3', 'heaterShakerV1B3', 'movableTrashB3'],
887+
VSC3: ['C3', 'magneticBlockV1C3', 'temperatureModuleV2C3', 'heaterShakerV1C3', 'movableTrashC3'],
888+
VSD3: ['D3', 'magneticBlockV1D3', 'temperatureModuleV2D3', 'heaterShakerV1D3', 'movableTrashD3', '96ChannelWasteChute', '1ChannelWasteChute', '8ChannelWasteChute', 'gripperWasteChute'],
941889
VSA4: ['fakeA4', 'flexStackerModuleV1A4'],
942890
VSB4: ['fakeB4', 'flexStackerModuleV1B4'],
943891
VSC4: ['fakeC4', 'flexStackerModuleV1C4'],
944-
VSD4: ['fakeD4', 'flexStackerModuleV1D4'],
892+
VSD4: ['fakeD4', 'flexStackerModuleV1D4']
945893
}
946894

895+
export const getVisualSlotIdFromAAId = (aaId:AddressableAreaNamesWithFakes): string => {
896+
const vsId = Object.entries(VS_TO_AA).find(([key, value]) => value.includes(aaId))?.[0]
897+
return vsId as string // should always find a match
898+
}
899+
947900
export const AA_TO_AA_SLOT: Record<string, AddressableAreaNamesWithFakes> = {
948901
// D4: 'fakeD4',
949902
// C4: 'fakeC4',
@@ -965,14 +918,14 @@ export const AA_TO_AA_SLOT: Record<string, AddressableAreaNamesWithFakes> = {
965918
// magneticBlockV1C1: 'C1',
966919
// magneticBlockV1B1: 'B1',
967920
// magneticBlockV1A1: 'A1',
968-
'1ChannelWasteChute': 'D3',
969-
'8ChannelWasteChute': 'D3',
970-
'96ChannelWasteChute': 'D3',
971-
gripperWasteChute: 'D3',
972-
temperatureModuleV2D3: 'D3',
973-
temperatureModuleV2C3: 'C3',
974-
temperatureModuleV2B3: 'B3',
975-
temperatureModuleV2A3: 'A3',
921+
// '1ChannelWasteChute': 'D3',
922+
// '8ChannelWasteChute': 'D3',
923+
// '96ChannelWasteChute': 'D3',
924+
// gripperWasteChute: 'D3',
925+
// temperatureModuleV2D3: 'D3',
926+
// temperatureModuleV2C3: 'C3',
927+
// temperatureModuleV2B3: 'B3',
928+
// temperatureModuleV2A3: 'A3',
976929
// temperatureModuleV2D2: 'D2',
977930
// temperatureModuleV2C2: 'C2',
978931
// temperatureModuleV2B2: 'B2',

0 commit comments

Comments
 (0)