1
- import { sortBy } from '@seedcompany/common' ;
1
+ import { mapOf , sortBy } from '@seedcompany/common' ;
2
2
import levenshtein from 'fastest-levenshtein' ;
3
3
import { startCase } from 'lodash' ;
4
4
import { type Column } from '~/common/xlsx.util' ;
@@ -7,7 +7,7 @@ import { type PnpExtractionResult, PnpProblemType } from './extraction-result';
7
7
import { type PlanningSheet } from './planning-sheet' ;
8
8
import { type ProgressSheet } from './progress-sheet' ;
9
9
10
- const ApprovedCustomSteps = new Map < string , Step > ( [
10
+ const ApprovedAliases = mapOf < string , Step > ( [
11
11
[ 'draft & keyboard' , Step . ExegesisAndFirstDraft ] ,
12
12
[ 'first draft' , Step . ExegesisAndFirstDraft ] ,
13
13
[ 'exegesis, 1st draft, keyboard' , Step . ExegesisAndFirstDraft ] ,
@@ -38,9 +38,7 @@ export function findStepColumns(
38
38
. walkRight ( )
39
39
. filter ( ( cell ) => ! ! cell . asString )
40
40
. map ( ( cell ) => ( {
41
- label :
42
- ApprovedCustomSteps . get ( cell . asString ! . trim ( ) . toLowerCase ( ) ) ??
43
- cell . asString ! ,
41
+ label : cell . asString ! . trim ( ) ,
44
42
column : cell . column ,
45
43
cell,
46
44
} ) )
@@ -69,6 +67,11 @@ const chooseStep = (
69
67
label : string ,
70
68
available : ReadonlySet < Step > ,
71
69
) : Step | undefined => {
70
+ const alias = ApprovedAliases . get ( label . toLowerCase ( ) ) ;
71
+ if ( alias ) {
72
+ return alias ;
73
+ }
74
+
72
75
const distances = available . values ( ) . map ( ( step ) => {
73
76
const humanLabel = startCase ( step ) . replace ( ' And ' , ' & ' ) ;
74
77
const distance = levenshtein . distance ( label , humanLabel ) ;
0 commit comments