catchup-library-web 2.2.21 → 2.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,89 +3,106 @@ import i18n from "../language/i18n";
3
3
  export const retrieveBrandDTOByUserProfileOptionList = (userProfile: any) => {
4
4
  const brandDTOOptionList = [];
5
5
  if (userProfile) {
6
- for (const branchDTO of userProfile.branchDTOList) {
7
- const currentBrand =
8
- branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
9
- if (
10
- brandDTOOptionList.findIndex(
11
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
12
- ) === -1
13
- ) {
14
- brandDTOOptionList.push({
15
- value: currentBrand.id,
16
- fullValue: currentBrand,
17
- text: currentBrand.name,
18
- });
6
+ if (userProfile.branchDTOList) {
7
+ for (const branchDTO of userProfile.branchDTOList) {
8
+ const currentBrand =
9
+ branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
10
+ if (
11
+ brandDTOOptionList.findIndex(
12
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
13
+ ) === -1
14
+ ) {
15
+ brandDTOOptionList.push({
16
+ value: currentBrand.id,
17
+ fullValue: currentBrand,
18
+ text: currentBrand.name,
19
+ });
20
+ }
19
21
  }
20
22
  }
21
- for (const gradeDTO of userProfile.gradeDTOList) {
22
- const currentBrand = gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
23
- if (
24
- brandDTOOptionList.findIndex(
25
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
26
- ) === -1
27
- ) {
28
- brandDTOOptionList.push({
29
- value: currentBrand.id,
30
- fullValue: currentBrand,
31
- text: currentBrand.name,
32
- });
23
+ if (userProfile.gradeDTOList) {
24
+ for (const gradeDTO of userProfile.gradeDTOList) {
25
+ const currentBrand =
26
+ gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
27
+ if (
28
+ brandDTOOptionList.findIndex(
29
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
30
+ ) === -1
31
+ ) {
32
+ brandDTOOptionList.push({
33
+ value: currentBrand.id,
34
+ fullValue: currentBrand,
35
+ text: currentBrand.name,
36
+ });
37
+ }
33
38
  }
34
39
  }
35
- for (const seasonDTO of userProfile.seasonDTOList) {
36
- const currentBrand = seasonDTO.institutionDTO.campusDTO.brandDTO;
37
- if (
38
- brandDTOOptionList.findIndex(
39
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
40
- ) === -1
41
- ) {
42
- brandDTOOptionList.push({
43
- value: currentBrand.id,
44
- fullValue: currentBrand,
45
- text: currentBrand.name,
46
- });
40
+
41
+ if (userProfile.seasonDTOList) {
42
+ for (const seasonDTO of userProfile.seasonDTOList) {
43
+ const currentBrand = seasonDTO.institutionDTO.campusDTO.brandDTO;
44
+ if (
45
+ brandDTOOptionList.findIndex(
46
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
47
+ ) === -1
48
+ ) {
49
+ brandDTOOptionList.push({
50
+ value: currentBrand.id,
51
+ fullValue: currentBrand,
52
+ text: currentBrand.name,
53
+ });
54
+ }
47
55
  }
48
56
  }
49
- for (const institutionDTO of userProfile.institutionDTOList) {
50
- const currentBrand = institutionDTO.campusDTO.brandDTO;
51
- if (
52
- brandDTOOptionList.findIndex(
53
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
54
- ) === -1
55
- ) {
56
- brandDTOOptionList.push({
57
- value: currentBrand.id,
58
- fullValue: currentBrand,
59
- text: currentBrand.name,
60
- });
57
+
58
+ if (userProfile.institutionDTOList) {
59
+ for (const institutionDTO of userProfile.institutionDTOList) {
60
+ const currentBrand = institutionDTO.campusDTO.brandDTO;
61
+ if (
62
+ brandDTOOptionList.findIndex(
63
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
64
+ ) === -1
65
+ ) {
66
+ brandDTOOptionList.push({
67
+ value: currentBrand.id,
68
+ fullValue: currentBrand,
69
+ text: currentBrand.name,
70
+ });
71
+ }
61
72
  }
62
73
  }
63
- for (const campusDTO of userProfile.campusDTOList) {
64
- const currentBrand = campusDTO.brandDTO;
65
- if (
66
- brandDTOOptionList.findIndex(
67
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
68
- ) === -1
69
- ) {
70
- brandDTOOptionList.push({
71
- value: currentBrand.id,
72
- fullValue: currentBrand,
73
- text: currentBrand.name,
74
- });
74
+
75
+ if (userProfile.campusDTOList) {
76
+ for (const campusDTO of userProfile.campusDTOList) {
77
+ const currentBrand = campusDTO.brandDTO;
78
+ if (
79
+ brandDTOOptionList.findIndex(
80
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
81
+ ) === -1
82
+ ) {
83
+ brandDTOOptionList.push({
84
+ value: currentBrand.id,
85
+ fullValue: currentBrand,
86
+ text: currentBrand.name,
87
+ });
88
+ }
75
89
  }
76
90
  }
77
- for (const brandDTO of userProfile.brandDTOList) {
78
- const currentBrand = brandDTO;
79
- if (
80
- brandDTOOptionList.findIndex(
81
- (brandDTOOption) => brandDTOOption.value === currentBrand.id
82
- ) === -1
83
- ) {
84
- brandDTOOptionList.push({
85
- value: currentBrand.id,
86
- fullValue: currentBrand,
87
- text: currentBrand.name,
88
- });
91
+
92
+ if (userProfile.brandDTOList) {
93
+ for (const brandDTO of userProfile.brandDTOList) {
94
+ const currentBrand = brandDTO;
95
+ if (
96
+ brandDTOOptionList.findIndex(
97
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
98
+ ) === -1
99
+ ) {
100
+ brandDTOOptionList.push({
101
+ value: currentBrand.id,
102
+ fullValue: currentBrand,
103
+ text: currentBrand.name,
104
+ });
105
+ }
89
106
  }
90
107
  }
91
108
  }
@@ -151,82 +168,97 @@ export const retrieveCampusDTOByUserProfileOptionList = (
151
168
  const campusDTOOptionList = [];
152
169
  if (userProfile) {
153
170
  if (selectedBrandId) {
154
- for (const branchDTO of userProfile.branchDTOList) {
155
- const currentCampus =
156
- branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO;
157
- if (
158
- campusDTOOptionList.findIndex(
159
- (campusDTOOption) => campusDTOOption.value === currentCampus.id
160
- ) === -1 &&
161
- currentCampus.brandDTO.id === parseFloat(selectedBrandId)
162
- ) {
163
- campusDTOOptionList.push({
164
- value: currentCampus.id,
165
- fullValue: currentCampus,
166
- text: currentCampus.name,
167
- });
171
+ if (userProfile.branchDTOList) {
172
+ for (const branchDTO of userProfile.branchDTOList) {
173
+ const currentCampus =
174
+ branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO;
175
+ if (
176
+ campusDTOOptionList.findIndex(
177
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
178
+ ) === -1 &&
179
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
180
+ ) {
181
+ campusDTOOptionList.push({
182
+ value: currentCampus.id,
183
+ fullValue: currentCampus,
184
+ text: currentCampus.name,
185
+ });
186
+ }
168
187
  }
169
188
  }
170
- for (const gradeDTO of userProfile.gradeDTOList) {
171
- const currentCampus = gradeDTO.seasonDTO.institutionDTO.campusDTO;
172
- if (
173
- campusDTOOptionList.findIndex(
174
- (campusDTOOption) => campusDTOOption.value === currentCampus.id
175
- ) === -1 &&
176
- currentCampus.brandDTO.id === parseFloat(selectedBrandId)
177
- ) {
178
- campusDTOOptionList.push({
179
- value: currentCampus.id,
180
- fullValue: currentCampus,
181
- text: currentCampus.name,
182
- });
189
+
190
+ if (userProfile.gradeDTOList) {
191
+ for (const gradeDTO of userProfile.gradeDTOList) {
192
+ const currentCampus = gradeDTO.seasonDTO.institutionDTO.campusDTO;
193
+ if (
194
+ campusDTOOptionList.findIndex(
195
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
196
+ ) === -1 &&
197
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
198
+ ) {
199
+ campusDTOOptionList.push({
200
+ value: currentCampus.id,
201
+ fullValue: currentCampus,
202
+ text: currentCampus.name,
203
+ });
204
+ }
183
205
  }
184
206
  }
185
- for (const seasonDTO of userProfile.seasonDTOList) {
186
- const currentCampus = seasonDTO.institutionDTO.campusDTO;
187
- if (
188
- campusDTOOptionList.findIndex(
189
- (campusDTOOption) => campusDTOOption.value === currentCampus.id
190
- ) === -1 &&
191
- currentCampus.brandDTO.id === parseFloat(selectedBrandId)
192
- ) {
193
- campusDTOOptionList.push({
194
- value: currentCampus.id,
195
- fullValue: currentCampus,
196
- text: currentCampus.name,
197
- });
207
+
208
+ if (userProfile.seasonDTOList) {
209
+ for (const seasonDTO of userProfile.seasonDTOList) {
210
+ const currentCampus = seasonDTO.institutionDTO.campusDTO;
211
+ if (
212
+ campusDTOOptionList.findIndex(
213
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
214
+ ) === -1 &&
215
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
216
+ ) {
217
+ campusDTOOptionList.push({
218
+ value: currentCampus.id,
219
+ fullValue: currentCampus,
220
+ text: currentCampus.name,
221
+ });
222
+ }
198
223
  }
199
224
  }
200
- for (const institutionDTO of userProfile.institutionDTOList) {
201
- const currentCampus = institutionDTO.campusDTO;
202
- if (
203
- campusDTOOptionList.findIndex(
204
- (campusDTOOption) => campusDTOOption.value === currentCampus.id
205
- ) === -1 &&
206
- currentCampus.brandDTO.id === parseFloat(selectedBrandId)
207
- ) {
208
- campusDTOOptionList.push({
209
- value: currentCampus.id,
210
- fullValue: currentCampus,
211
- text: currentCampus.name,
212
- });
225
+
226
+ if (userProfile.institutionDTOList) {
227
+ for (const institutionDTO of userProfile.institutionDTOList) {
228
+ const currentCampus = institutionDTO.campusDTO;
229
+ if (
230
+ campusDTOOptionList.findIndex(
231
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
232
+ ) === -1 &&
233
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
234
+ ) {
235
+ campusDTOOptionList.push({
236
+ value: currentCampus.id,
237
+ fullValue: currentCampus,
238
+ text: currentCampus.name,
239
+ });
240
+ }
213
241
  }
214
242
  }
215
- for (const campusDTO of userProfile.campusDTOList) {
216
- const currentCampus = campusDTO;
217
- if (
218
- campusDTOOptionList.findIndex(
219
- (campusDTOOption) => campusDTOOption.value === currentCampus.id
220
- ) === -1 &&
221
- currentCampus.brandDTO.id === parseFloat(selectedBrandId)
222
- ) {
223
- campusDTOOptionList.push({
224
- value: currentCampus.id,
225
- fullValue: currentCampus,
226
- text: currentCampus.name,
227
- });
243
+
244
+ if (userProfile.campusDTOList) {
245
+ for (const campusDTO of userProfile.campusDTOList) {
246
+ const currentCampus = campusDTO;
247
+ if (
248
+ campusDTOOptionList.findIndex(
249
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
250
+ ) === -1 &&
251
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
252
+ ) {
253
+ campusDTOOptionList.push({
254
+ value: currentCampus.id,
255
+ fullValue: currentCampus,
256
+ text: currentCampus.name,
257
+ });
258
+ }
228
259
  }
229
260
  }
261
+
230
262
  return campusDTOOptionList;
231
263
  }
232
264
  }
@@ -242,76 +274,88 @@ export const retrieveInstitutionDTOByUserProfileOptionList = (
242
274
  const institutionDTOOptionList = [];
243
275
  if (userProfile) {
244
276
  if (selectedCampusId) {
245
- for (const branchDTO of userProfile.branchDTOList) {
246
- const currentInstitution = branchDTO.gradeDTO.seasonDTO.institutionDTO;
247
- if (
248
- institutionDTOOptionList.findIndex(
249
- (institutionDTOOption) =>
250
- institutionDTOOption.value === currentInstitution.id
251
- ) === -1 &&
252
- currentInstitution.campusDTO.brandDTO.id ===
253
- parseFloat(selectedBrandId) &&
254
- currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
255
- ) {
256
- institutionDTOOptionList.push({
257
- value: currentInstitution.id,
258
- fullValue: currentInstitution,
259
- text: currentInstitution.name,
260
- });
277
+ if (userProfile.branchDTOList) {
278
+ for (const branchDTO of userProfile.branchDTOList) {
279
+ const currentInstitution =
280
+ branchDTO.gradeDTO.seasonDTO.institutionDTO;
281
+ if (
282
+ institutionDTOOptionList.findIndex(
283
+ (institutionDTOOption) =>
284
+ institutionDTOOption.value === currentInstitution.id
285
+ ) === -1 &&
286
+ currentInstitution.campusDTO.brandDTO.id ===
287
+ parseFloat(selectedBrandId) &&
288
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
289
+ ) {
290
+ institutionDTOOptionList.push({
291
+ value: currentInstitution.id,
292
+ fullValue: currentInstitution,
293
+ text: currentInstitution.name,
294
+ });
295
+ }
261
296
  }
262
297
  }
263
- for (const gradeDTO of userProfile.gradeDTOList) {
264
- const currentInstitution = gradeDTO.seasonDTO.institutionDTO;
265
- if (
266
- institutionDTOOptionList.findIndex(
267
- (institutionDTOOption) =>
268
- institutionDTOOption.value === currentInstitution.id
269
- ) === -1 &&
270
- currentInstitution.campusDTO.brandDTO.id ===
271
- parseFloat(selectedBrandId) &&
272
- currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
273
- ) {
274
- institutionDTOOptionList.push({
275
- value: currentInstitution.id,
276
- fullValue: currentInstitution,
277
- text: currentInstitution.name,
278
- });
298
+
299
+ if (userProfile.gradeDTOList) {
300
+ for (const gradeDTO of userProfile.gradeDTOList) {
301
+ const currentInstitution = gradeDTO.seasonDTO.institutionDTO;
302
+ if (
303
+ institutionDTOOptionList.findIndex(
304
+ (institutionDTOOption) =>
305
+ institutionDTOOption.value === currentInstitution.id
306
+ ) === -1 &&
307
+ currentInstitution.campusDTO.brandDTO.id ===
308
+ parseFloat(selectedBrandId) &&
309
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
310
+ ) {
311
+ institutionDTOOptionList.push({
312
+ value: currentInstitution.id,
313
+ fullValue: currentInstitution,
314
+ text: currentInstitution.name,
315
+ });
316
+ }
279
317
  }
280
318
  }
281
- for (const seasonDTO of userProfile.seasonDTOList) {
282
- const currentInstitution = seasonDTO.institutionDTO;
283
- if (
284
- institutionDTOOptionList.findIndex(
285
- (institutionDTOOption) =>
286
- institutionDTOOption.value === currentInstitution.id
287
- ) === -1 &&
288
- currentInstitution.campusDTO.brandDTO.id ===
289
- parseFloat(selectedBrandId) &&
290
- currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
291
- ) {
292
- institutionDTOOptionList.push({
293
- value: currentInstitution.id,
294
- fullValue: currentInstitution,
295
- text: currentInstitution.name,
296
- });
319
+
320
+ if (userProfile.seasonDTOList) {
321
+ for (const seasonDTO of userProfile.seasonDTOList) {
322
+ const currentInstitution = seasonDTO.institutionDTO;
323
+ if (
324
+ institutionDTOOptionList.findIndex(
325
+ (institutionDTOOption) =>
326
+ institutionDTOOption.value === currentInstitution.id
327
+ ) === -1 &&
328
+ currentInstitution.campusDTO.brandDTO.id ===
329
+ parseFloat(selectedBrandId) &&
330
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
331
+ ) {
332
+ institutionDTOOptionList.push({
333
+ value: currentInstitution.id,
334
+ fullValue: currentInstitution,
335
+ text: currentInstitution.name,
336
+ });
337
+ }
297
338
  }
298
339
  }
299
- for (const institutionDTO of userProfile.institutionDTOList) {
300
- const currentInstitution = institutionDTO;
301
- if (
302
- institutionDTOOptionList.findIndex(
303
- (institutionDTOOption) =>
304
- institutionDTOOption.value === currentInstitution.id
305
- ) === -1 &&
306
- currentInstitution.campusDTO.brandDTO.id ===
307
- parseFloat(selectedBrandId) &&
308
- currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
309
- ) {
310
- institutionDTOOptionList.push({
311
- value: currentInstitution.id,
312
- fullValue: currentInstitution,
313
- text: currentInstitution.name,
314
- });
340
+
341
+ if (userProfile.institutionDTOList) {
342
+ for (const institutionDTO of userProfile.institutionDTOList) {
343
+ const currentInstitution = institutionDTO;
344
+ if (
345
+ institutionDTOOptionList.findIndex(
346
+ (institutionDTOOption) =>
347
+ institutionDTOOption.value === currentInstitution.id
348
+ ) === -1 &&
349
+ currentInstitution.campusDTO.brandDTO.id ===
350
+ parseFloat(selectedBrandId) &&
351
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
352
+ ) {
353
+ institutionDTOOptionList.push({
354
+ value: currentInstitution.id,
355
+ fullValue: currentInstitution,
356
+ text: currentInstitution.name,
357
+ });
358
+ }
315
359
  }
316
360
  }
317
361
  }
@@ -327,55 +371,66 @@ export const retrieveSeasonDTOByUserProfileOptionList = (
327
371
  const seasonDTOOptionList = [];
328
372
  if (userProfile) {
329
373
  if (selectedInstitutionId) {
330
- for (const branchDTO of userProfile.branchDTOList) {
331
- const currentSeason = branchDTO.gradeDTO.seasonDTO;
332
- if (
333
- seasonDTOOptionList.findIndex(
334
- (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
335
- ) === -1 &&
336
- currentSeason.institutionDTO.campusDTO.brandDTO.id ===
337
- parseFloat(selectedBrandId) &&
338
- currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
339
- ) {
340
- seasonDTOOptionList.push({
341
- value: currentSeason.id,
342
- fullValue: currentSeason,
343
- text: currentSeason.name,
344
- });
374
+ if (userProfile.branchDTOList) {
375
+ for (const branchDTO of userProfile.branchDTOList) {
376
+ const currentSeason = branchDTO.gradeDTO.seasonDTO;
377
+ if (
378
+ seasonDTOOptionList.findIndex(
379
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
380
+ ) === -1 &&
381
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
382
+ parseFloat(selectedBrandId) &&
383
+ currentSeason.institutionDTO.id ===
384
+ parseFloat(selectedInstitutionId)
385
+ ) {
386
+ seasonDTOOptionList.push({
387
+ value: currentSeason.id,
388
+ fullValue: currentSeason,
389
+ text: currentSeason.name,
390
+ });
391
+ }
345
392
  }
346
393
  }
347
- for (const gradeDTO of userProfile.gradeDTOList) {
348
- const currentSeason = gradeDTO.seasonDTO;
349
- if (
350
- seasonDTOOptionList.findIndex(
351
- (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
352
- ) === -1 &&
353
- currentSeason.institutionDTO.campusDTO.brandDTO.id ===
354
- parseFloat(selectedBrandId) &&
355
- currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
356
- ) {
357
- seasonDTOOptionList.push({
358
- value: currentSeason.id,
359
- fullValue: currentSeason,
360
- text: currentSeason.name,
361
- });
394
+
395
+ if (userProfile.gradeDTOList) {
396
+ for (const gradeDTO of userProfile.gradeDTOList) {
397
+ const currentSeason = gradeDTO.seasonDTO;
398
+ if (
399
+ seasonDTOOptionList.findIndex(
400
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
401
+ ) === -1 &&
402
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
403
+ parseFloat(selectedBrandId) &&
404
+ currentSeason.institutionDTO.id ===
405
+ parseFloat(selectedInstitutionId)
406
+ ) {
407
+ seasonDTOOptionList.push({
408
+ value: currentSeason.id,
409
+ fullValue: currentSeason,
410
+ text: currentSeason.name,
411
+ });
412
+ }
362
413
  }
363
414
  }
364
- for (const seasonDTO of userProfile.seasonDTOList) {
365
- const currentSeason = seasonDTO;
366
- if (
367
- seasonDTOOptionList.findIndex(
368
- (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
369
- ) === -1 &&
370
- currentSeason.institutionDTO.campusDTO.brandDTO.id ===
371
- parseFloat(selectedBrandId) &&
372
- currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
373
- ) {
374
- seasonDTOOptionList.push({
375
- value: currentSeason.id,
376
- fullValue: currentSeason,
377
- text: currentSeason.name,
378
- });
415
+
416
+ if (userProfile.seasonDTOList) {
417
+ for (const seasonDTO of userProfile.seasonDTOList) {
418
+ const currentSeason = seasonDTO;
419
+ if (
420
+ seasonDTOOptionList.findIndex(
421
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
422
+ ) === -1 &&
423
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
424
+ parseFloat(selectedBrandId) &&
425
+ currentSeason.institutionDTO.id ===
426
+ parseFloat(selectedInstitutionId)
427
+ ) {
428
+ seasonDTOOptionList.push({
429
+ value: currentSeason.id,
430
+ fullValue: currentSeason,
431
+ text: currentSeason.name,
432
+ });
433
+ }
379
434
  }
380
435
  }
381
436
  }
@@ -391,38 +446,43 @@ export const retrieveGradeDTOByUserProfileOptionList = (
391
446
  const gradeDTOOptionList = [];
392
447
  if (userProfile) {
393
448
  if (selectedSeasonId) {
394
- for (const branchDTO of userProfile.branchDTOList) {
395
- const currentGrade = branchDTO.gradeDTO;
396
- if (
397
- gradeDTOOptionList.findIndex(
398
- (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
399
- ) === -1 &&
400
- currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
401
- parseFloat(selectedBrandId) &&
402
- currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
403
- ) {
404
- gradeDTOOptionList.push({
405
- value: currentGrade.id,
406
- fullValue: currentGrade,
407
- text: currentGrade.name,
408
- });
449
+ if (userProfile.branchDTOList) {
450
+ for (const branchDTO of userProfile.branchDTOList) {
451
+ const currentGrade = branchDTO.gradeDTO;
452
+ if (
453
+ gradeDTOOptionList.findIndex(
454
+ (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
455
+ ) === -1 &&
456
+ currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
457
+ parseFloat(selectedBrandId) &&
458
+ currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
459
+ ) {
460
+ gradeDTOOptionList.push({
461
+ value: currentGrade.id,
462
+ fullValue: currentGrade,
463
+ text: currentGrade.name,
464
+ });
465
+ }
409
466
  }
410
467
  }
411
- for (const gradeDTO of userProfile.gradeDTOList) {
412
- const currentGrade = gradeDTO;
413
- if (
414
- gradeDTOOptionList.findIndex(
415
- (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
416
- ) === -1 &&
417
- currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
418
- parseFloat(selectedBrandId) &&
419
- currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
420
- ) {
421
- gradeDTOOptionList.push({
422
- value: currentGrade.id,
423
- fullValue: currentGrade,
424
- text: currentGrade.name,
425
- });
468
+
469
+ if (userProfile.gradeDTOList) {
470
+ for (const gradeDTO of userProfile.gradeDTOList) {
471
+ const currentGrade = gradeDTO;
472
+ if (
473
+ gradeDTOOptionList.findIndex(
474
+ (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
475
+ ) === -1 &&
476
+ currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
477
+ parseFloat(selectedBrandId) &&
478
+ currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
479
+ ) {
480
+ gradeDTOOptionList.push({
481
+ value: currentGrade.id,
482
+ fullValue: currentGrade,
483
+ text: currentGrade.name,
484
+ });
485
+ }
426
486
  }
427
487
  }
428
488
  }
@@ -438,21 +498,23 @@ export const retrieveBranchDTOByUserProfileOptionList = (
438
498
  const branchDTOOptionList = [];
439
499
  if (userProfile) {
440
500
  if (selectedGradeId) {
441
- for (const branchDTO of userProfile.branchDTOList) {
442
- const currentBranch = branchDTO;
443
- if (
444
- branchDTOOptionList.findIndex(
445
- (branchDTOOption) => branchDTOOption.value === currentBranch.id
446
- ) === -1 &&
447
- currentBranch.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO
448
- .id === parseFloat(selectedBrandId) &&
449
- currentBranch.gradeDTO.id === parseFloat(selectedGradeId)
450
- ) {
451
- branchDTOOptionList.push({
452
- value: currentBranch.id,
453
- fullValue: currentBranch,
454
- text: currentBranch.name,
455
- });
501
+ if (userProfile.branchDTOList) {
502
+ for (const branchDTO of userProfile.branchDTOList) {
503
+ const currentBranch = branchDTO;
504
+ if (
505
+ branchDTOOptionList.findIndex(
506
+ (branchDTOOption) => branchDTOOption.value === currentBranch.id
507
+ ) === -1 &&
508
+ currentBranch.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO
509
+ .id === parseFloat(selectedBrandId) &&
510
+ currentBranch.gradeDTO.id === parseFloat(selectedGradeId)
511
+ ) {
512
+ branchDTOOptionList.push({
513
+ value: currentBranch.id,
514
+ fullValue: currentBranch,
515
+ text: currentBranch.name,
516
+ });
517
+ }
456
518
  }
457
519
  }
458
520
  }