@byu-oit/vue-decision-processing-components 9.5.2 → 9.5.3
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.
- package/Report.vue +11 -29
- package/package.json +1 -1
package/Report.vue
CHANGED
|
@@ -301,27 +301,18 @@ export default {
|
|
|
301
301
|
}
|
|
302
302
|
return q
|
|
303
303
|
},
|
|
304
|
-
async fetchConfigs() {
|
|
305
|
-
try {
|
|
306
|
-
const base = this.env === 'development'
|
|
307
|
-
? 'https://api-sandbox.byu.edu'
|
|
308
|
-
: 'https://api.byu.edu'
|
|
309
|
-
const institution = this.institution
|
|
310
|
-
const response = await fetch(`${base}/domain/applications/${institution}/admission/v1/configs`)
|
|
311
|
-
const json = await response.json()
|
|
312
|
-
this.configs = [...json.closed, ...json.open]
|
|
313
|
-
} catch (err) {
|
|
314
|
-
console.error('Failed to fetch admit period configs:', err)
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
304
|
setDefaultAdmitPeriod() {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
305
|
+
try {
|
|
306
|
+
const today = new Date()
|
|
307
|
+
const future = this.configs
|
|
308
|
+
.filter(p => new Date(p.close) >= today)
|
|
309
|
+
.sort((a, b) => new Date(a.close) - new Date(b.close))
|
|
322
310
|
|
|
323
|
-
|
|
324
|
-
|
|
311
|
+
if (future.length > 0) {
|
|
312
|
+
this.selectedAdmitPeriod = future[0].admit_period
|
|
313
|
+
}
|
|
314
|
+
} catch (err) {
|
|
315
|
+
console.warn('Failed to set default admit period. Using original default admit period. Error: ', err)
|
|
325
316
|
}
|
|
326
317
|
},
|
|
327
318
|
},
|
|
@@ -346,16 +337,7 @@ export default {
|
|
|
346
337
|
if (this.autoRefresh) {
|
|
347
338
|
document.addEventListener('visibilitychange', this.reloadOnPageBackIntoFocus)
|
|
348
339
|
}
|
|
349
|
-
|
|
350
|
-
if (this.configs.length === 0) {
|
|
351
|
-
this.fetchConfigs()
|
|
352
|
-
}
|
|
353
|
-
// Only set the default admit period if we have configs, else keep the original default
|
|
354
|
-
if (this.configs.length > 0) {
|
|
355
|
-
this.setDefaultAdmitPeriod()
|
|
356
|
-
} else {
|
|
357
|
-
console.warn('No admit period configs found. Using original default admit period.')
|
|
358
|
-
}
|
|
340
|
+
this.setDefaultAdmitPeriod()
|
|
359
341
|
},
|
|
360
342
|
beforeDestroy () {
|
|
361
343
|
if (this.autoRefresh) {
|
package/package.json
CHANGED