Skip to content

Commit 7a8e8b3

Browse files
committed
front: change the strategy. Filter DPY-MAS opertaional points inside the request
Signed-off-by: nncluzu <[email protected]>
1 parent 5bfa606 commit 7a8e8b3

File tree

4 files changed

+367
-193
lines changed

4 files changed

+367
-193
lines changed

front/src/applications/stdcm/components/StdcmForm/StdcmOperationalPoint.tsx

+6-18
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ import { useEffect, useMemo } from 'react';
22

33
import { Select, ComboBox } from '@osrd-project/ui-core';
44
import { useTranslation } from 'react-i18next';
5-
import { useSelector } from 'react-redux';
65

7-
import CI_CH_OPERATIONAL_POINTS_ON_DPY_MAS from 'assets/operationStudies/ciChOperationalPointsOnDPYMAS';
86
import { type SearchResultItemOperationalPoint } from 'common/api/osrdEditoastApi';
97
import useSearchOperationalPoint from 'common/Map/Search/useSearchOperationalPoint';
108
import { useOsrdConfActions } from 'common/osrdContext';
119
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
1210
import type { StdcmPathStep } from 'reducers/osrdconf/types';
13-
import { userHasOnlyStdcmRoles } from 'reducers/user/userSelectors';
1411
import { useAppDispatch } from 'store';
1512
import { normalized } from 'utils/strings';
1613
import { createFixedSelectOptions } from 'utils/uiCoreHelpers';
@@ -35,29 +32,20 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio
3532
useSearchOperationalPoint({
3633
initialSearchTerm: location?.name,
3734
initialChCodeFilter: location?.secondary_code,
35+
isStdcm: true,
3836
});
3937

40-
const hasOnlyStdcmRoles = useSelector(userHasOnlyStdcmRoles);
41-
4238
const { updateStdcmPathStep } = useOsrdConfActions() as StdcmConfSliceActions;
4339

4440
const operationalPointsSuggestions = useMemo(
4541
() =>
4642
// Temporary filter added to show a more restrictive list of suggestions inside the stdcm app.
4743
sortedSearchResults
48-
.filter((op) => {
49-
const isNameMatch = normalized(op.name).startsWith(normalized(searchTerm));
50-
const isTrigramMatch = op.trigram === searchTerm.toUpperCase();
51-
52-
if (hasOnlyStdcmRoles) {
53-
return (
54-
CI_CH_OPERATIONAL_POINTS_ON_DPY_MAS[op.ci]?.includes(op.ch) &&
55-
(isNameMatch || isTrigramMatch)
56-
);
57-
}
58-
59-
return isNameMatch || isTrigramMatch;
60-
})
44+
.filter(
45+
(op) =>
46+
normalized(op.name).startsWith(normalized(searchTerm)) ||
47+
op.trigram === searchTerm.toUpperCase()
48+
)
6149
.reduce((acc, p) => {
6250
const newObject = {
6351
label: [p.trigram, p.name].join(' '),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
const DPY_TO_MAS_OPERATIONAL_POINTS: [number, string][] = [
2+
[112136, '00'],
3+
[140210, '00'],
4+
[140228, '00'],
5+
[140236, '00'],
6+
[140244, '00'],
7+
[140251, '00'],
8+
[140269, '00'],
9+
[140277, '00'],
10+
[140285, '00'],
11+
[144816, '00'],
12+
[207779, '00'],
13+
[352054, '00'],
14+
[357178, '00'],
15+
[441535, 'EP'],
16+
[556621, '00'],
17+
[598482, '00'],
18+
[712026, '00'],
19+
[712604, '00'],
20+
[712620, '00'],
21+
[712679, '00'],
22+
[713032, 'P1'],
23+
[713032, 'P2'],
24+
[713032, 'P3'],
25+
[713032, 'P4'],
26+
[713040, 'AS'],
27+
[713040, 'ES'],
28+
[713503, '00'],
29+
[713511, 'BV'],
30+
[713529, '00'],
31+
[713529, '12'],
32+
[713529, 'V9'],
33+
[713537, '00'],
34+
[713545, '00'],
35+
[713545, 'EN'],
36+
[713560, '00'],
37+
[713578, '3E'],
38+
[713578, 'BN'],
39+
[713578, 'BS'],
40+
[713578, 'BV'],
41+
[713586, '00'],
42+
[713628, '00'],
43+
[713636, '00'],
44+
[713644, '00'],
45+
[713651, 'BV'],
46+
[713669, '00'],
47+
[713677, '00'],
48+
[713693, '00'],
49+
[713701, 'BV'],
50+
[713735, 'BV'],
51+
[713735, 'EP'],
52+
[713867, 'ZI'],
53+
[713875, '13'],
54+
[713875, '3B'],
55+
[713875, 'AT'],
56+
[713875, 'BK'],
57+
[713875, 'P2'],
58+
[713875, 'P3'],
59+
[713875, 'RA'],
60+
[713875, 'RI'],
61+
[713875, 'RO'],
62+
[713875, 'RP'],
63+
[718296, 'BF'],
64+
[718296, 'BV'],
65+
[721001, '13'],
66+
[721001, 'AN'],
67+
[721001, 'AS'],
68+
[721001, 'BV'],
69+
[721001, 'FP'],
70+
[721001, 'TU'],
71+
[721225, '00'],
72+
[721241, '00'],
73+
[721266, '00'],
74+
[721282, 'BV'],
75+
[721282, 'P1'],
76+
[721282, 'P2'],
77+
[721282, 'VG'],
78+
[721290, 'BV'],
79+
[721290, 'KM'],
80+
[721290, 'PK'],
81+
[721324, '00'],
82+
[721332, 'BV'],
83+
[721332, 'PK'],
84+
[721340, 'BV'],
85+
[721340, 'PK'],
86+
[721357, '00'],
87+
[721357, 'V3'],
88+
[722009, '21'],
89+
[722009, 'AG'],
90+
[722025, 'BV'],
91+
[722025, 'K1'],
92+
[722025, 'PS'],
93+
[722207, '00'],
94+
[722231, '00'],
95+
[722249, '00'],
96+
[722264, 'BV'],
97+
[722298, '00'],
98+
[722306, 'P1'],
99+
[722306, 'P2'],
100+
[722314, 'BV'],
101+
[722322, '00'],
102+
[722348, '00'],
103+
[722439, '21'],
104+
[722439, '25'],
105+
[722439, 'BR'],
106+
[722439, 'BV'],
107+
[722439, 'KM'],
108+
[722520, 'BN'],
109+
[722520, 'BS'],
110+
[722520, 'FR'],
111+
[722520, 'IT'],
112+
[722520, 'NS'],
113+
[722520, 'SN'],
114+
[722538, '00'],
115+
[722546, '00'],
116+
[722553, '00'],
117+
[722561, 'BV'],
118+
[722561, 'HA'],
119+
[722561, 'P1'],
120+
[722579, 'BV'],
121+
[722579, 'PK'],
122+
[722579, 'UR'],
123+
[722587, 'BV'],
124+
[722587, 'PU'],
125+
[722645, '00'],
126+
[722652, '00'],
127+
[722660, 'BV'],
128+
[722678, '00'],
129+
[722686, '00'],
130+
[723197, 'AN'],
131+
[723197, 'AS'],
132+
[723197, 'BF'],
133+
[723197, 'BV'],
134+
[723197, 'ES'],
135+
[723197, 'G1'],
136+
[723197, 'KN'],
137+
[723197, 'KS'],
138+
[723197, 'PO'],
139+
[723197, 'SM'],
140+
[723254, '00'],
141+
[723502, '00'],
142+
[723528, '00'],
143+
[723536, '00'],
144+
[723544, 'BV'],
145+
[723551, '00'],
146+
[723569, 'BV'],
147+
[723577, '00'],
148+
[723585, '00'],
149+
[725002, 'AS'],
150+
[725002, 'BF'],
151+
[725002, 'BV'],
152+
[725002, 'FI'],
153+
[725002, 'PA'],
154+
[725606, '00'],
155+
[725614, '00'],
156+
[725614, 'AG'],
157+
[725614, 'PV'],
158+
[725622, '00'],
159+
[725622, 'AG'],
160+
[725655, 'AG'],
161+
[725655, 'BV'],
162+
[725655, 'PV'],
163+
[725663, '00'],
164+
[725671, '00'],
165+
[725689, 'BF'],
166+
[725689, 'BV'],
167+
[725689, 'CH'],
168+
[725689, 'FA'],
169+
[725689, 'KM'],
170+
[725689, 'PK'],
171+
[725689, 'PV'],
172+
[725689, 'RN'],
173+
[725689, 'RS'],
174+
[725713, '00'],
175+
[725721, '00'],
176+
[725721, 'V3'],
177+
[725721, 'V4'],
178+
[725739, 'BV'],
179+
[725739, 'PK'],
180+
[728006, '27'],
181+
[728006, '74'],
182+
[728006, '7P'],
183+
[728006, 'AG'],
184+
[728006, 'CV'],
185+
[728006, 'J1'],
186+
[728006, 'KM'],
187+
[728006, 'MT'],
188+
[728006, 'P7'],
189+
[728006, 'PO'],
190+
[728006, 'SF'],
191+
[728006, 'VI'],
192+
[728501, 'BV'],
193+
[742114, '00'],
194+
[743005, 'BV'],
195+
[743005, 'P1'],
196+
[743005, 'P2'],
197+
[743104, 'BV'],
198+
[743112, '00'],
199+
[743120, '00'],
200+
[743146, 'BV'],
201+
[743146, 'SM'],
202+
[743203, '00'],
203+
[743211, '00'],
204+
[743708, 'BV'],
205+
[743716, 'AG'],
206+
[743716, 'AR'],
207+
[743716, 'BV'],
208+
[743716, 'EP'],
209+
[743716, 'P1'],
210+
[743716, 'P2'],
211+
[743716, 'P5'],
212+
[753004, 'A2'],
213+
[753004, 'AN'],
214+
[753004, 'AT'],
215+
[753004, 'BN'],
216+
[753004, 'BV'],
217+
[753004, 'DP'],
218+
[753004, 'FD'],
219+
[753004, 'FR'],
220+
[753004, 'PC'],
221+
[753004, 'RC'],
222+
[753004, 'RL'],
223+
[753004, 'SC'],
224+
[753657, 'BV'],
225+
[753681, '00'],
226+
[753681, '3G'],
227+
[753681, 'KM'],
228+
[753707, '00'],
229+
[753715, '00'],
230+
[753731, '00'],
231+
[753764, '00'],
232+
[761007, 'BG'],
233+
[761007, 'BP'],
234+
[761007, 'BV'],
235+
[761007, 'ES'],
236+
[761007, 'IT'],
237+
[761007, 'JO'],
238+
[761106, '62'],
239+
[761106, 'BN'],
240+
[761106, 'BS'],
241+
[761106, 'BV'],
242+
[761106, 'NS'],
243+
[761122, 'BV'],
244+
[761130, '00'],
245+
[761163, '00'],
246+
[761189, 'BV'],
247+
[761205, 'AS'],
248+
[761205, 'BV'],
249+
[761205, 'P1'],
250+
[761205, 'P2'],
251+
[761247, 'BS'],
252+
[761247, 'BV'],
253+
[761247, 'NS'],
254+
[761247, 'RC'],
255+
[761262, '00'],
256+
[761403, 'BV'],
257+
[761403, 'CV'],
258+
[761403, 'NS'],
259+
[761403, 'P1'],
260+
[761403, 'RN'],
261+
[761437, '00'],
262+
[761460, 'BV'],
263+
[761460, 'SG'],
264+
[761486, '00'],
265+
[761494, '00'],
266+
[761502, 'EP'],
267+
[761528, '00'],
268+
[761544, 'BP'],
269+
[761544, 'BT'],
270+
[761544, 'NS'],
271+
[761544, 'P1'],
272+
[764001, 'BV'],
273+
[764290, '00'],
274+
[764308, 'BF'],
275+
[764308, 'BV'],
276+
[764308, 'RL'],
277+
[764357, '00'],
278+
[764407, '00'],
279+
[764449, 'BV'],
280+
[764472, 'AS'],
281+
[764472, 'BV'],
282+
[764472, 'PN'],
283+
[764506, 'EP'],
284+
[764522, 'BV'],
285+
[764522, 'EP'],
286+
[764555, '00'],
287+
[764571, 'BV'],
288+
[764571, 'EP'],
289+
[764613, '00'],
290+
[765008, 'BC'],
291+
[765008, 'BR'],
292+
[765008, 'BV'],
293+
[765024, 'A1'],
294+
[765024, 'A2'],
295+
[765024, 'P1'],
296+
[765024, 'RP'],
297+
[765040, '2T'],
298+
[765040, 'BC'],
299+
[765040, 'CF'],
300+
[765040, 'DU'],
301+
[765040, 'PC'],
302+
[765040, 'UD'],
303+
[765040, 'VC'],
304+
[765107, 'AS'],
305+
[765107, 'BV'],
306+
[765107, 'KP'],
307+
[765107, 'PK'],
308+
[765107, 'PR'],
309+
[765180, 'BV'],
310+
[765198, '00'],
311+
[765206, '00'],
312+
[765206, '2B'],
313+
[765255, 'BV'],
314+
[765305, '00'],
315+
[765339, '00'],
316+
[765354, 'KP'],
317+
[765354, 'PK'],
318+
[765354, 'RN'],
319+
[765354, 'RS'],
320+
[765354, 'V4'],
321+
[765354, 'V5'],
322+
[765412, '00'],
323+
[765420, '00'],
324+
[765438, '00'],
325+
[765446, '00'],
326+
[765453, '00'],
327+
[765479, '00'],
328+
[765503, 'BV'],
329+
[765503, 'CB'],
330+
[765842, 'EP'],
331+
[765875, 'BR'],
332+
[765875, 'BV'],
333+
[765875, 'RN'],
334+
[21030, 'BV'],
335+
];
336+
337+
export default DPY_TO_MAS_OPERATIONAL_POINTS;

0 commit comments

Comments
 (0)