@byu-oit/vue-decision-processing-components 9.5.1 → 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.
Files changed (2) hide show
  1. package/Report.vue +17 -34
  2. package/package.json +1 -1
package/Report.vue CHANGED
@@ -143,7 +143,8 @@ export default {
143
143
  },
144
144
  computed: {
145
145
  ...mapState({
146
- institution: state => state.ui.institution
146
+ institution: state => state.ui.institution,
147
+ env: state => state.environment
147
148
  }),
148
149
  metadata () {
149
150
  return this.$store.getters.reportMetadata(this.reportName)
@@ -190,8 +191,8 @@ export default {
190
191
  }
191
192
  // appends institution if available to url search params
192
193
  if(this.metadata.parameters.includes('institutions')) {
193
- if(this.metadata.parameters.institutions.includes(state.institution))
194
- q.append('institution', state.institution)
194
+ if(this.metadata.parameters.institutions.includes(this.institution))
195
+ q.append('institution', this.institution)
195
196
  }
196
197
 
197
198
  const url = this.baseUrl + '?' + q.toString()
@@ -295,32 +296,23 @@ export default {
295
296
  }
296
297
  // appends institution if available to url search params
297
298
  if(this.metadata.parameters.includes('institutions')) {
298
- if(this.metadata.parameters.institutions.includes(state.institution))
299
- q.append('institution', state.institution)
299
+ if(this.metadata.parameters.institutions.includes(this.institution))
300
+ q.append('institution', this.institution)
300
301
  }
301
302
  return q
302
303
  },
303
- async fetchConfigs() {
304
- try {
305
- const base = this.env === 'development'
306
- ? 'https://api-sandbox.byu.edu'
307
- : 'https://api.byu.edu'
308
- const institution = state.institution
309
- const response = await fetch(`${base}/domain/applications/${institution}/admission/v1/configs`)
310
- const json = await response.json()
311
- this.configs = [...json.closed, ...json.open]
312
- } catch (err) {
313
- console.error('Failed to fetch admit period configs:', err)
314
- }
315
- },
316
304
  setDefaultAdmitPeriod() {
317
- const today = new Date()
318
- const future = this.configs
319
- .filter(p => new Date(p.close) >= today)
320
- .sort((a, b) => new Date(a.close) - new Date(b.close))
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))
321
310
 
322
- if (future.length > 0) {
323
- this.selectedAdmitPeriod = future[0].admit_period
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)
324
316
  }
325
317
  },
326
318
  },
@@ -345,16 +337,7 @@ export default {
345
337
  if (this.autoRefresh) {
346
338
  document.addEventListener('visibilitychange', this.reloadOnPageBackIntoFocus)
347
339
  }
348
- // Only fetch configs if none were passed in
349
- if (this.configs.length === 0) {
350
- this.fetchConfigs()
351
- }
352
- // Only set the default admit period if we have configs, else keep the original default
353
- if (this.configs.length > 0) {
354
- this.setDefaultAdmitPeriod()
355
- } else {
356
- console.warn('No admit period configs found. Using original default admit period.')
357
- }
340
+ this.setDefaultAdmitPeriod()
358
341
  },
359
342
  beforeDestroy () {
360
343
  if (this.autoRefresh) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.5.1",
3
+ "version": "9.5.3",
4
4
  "description": "Vue components shared between decision processing systems for the CES schools.",
5
5
  "dependencies": {
6
6
  "@fortawesome/fontawesome-free": "^5.15.4",