@byu-oit/vue-decision-processing-components 8.33.2 → 8.34.0

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.
@@ -24,60 +24,16 @@ import { faCalendar } from '@fortawesome/free-solid-svg-icons'
24
24
 
25
25
  import { mapState, mapMutations, mapActions } from 'vuex'
26
26
 
27
- const admitPeriods = {
28
- '20223': {
29
- period: '20223',
30
- description: '2022 Spring',
31
- long_description: 'Spring 2022',
32
- school: 'byuh',
33
- application_open: '06-01-2022',
34
- application_close: '11-01-2022',
35
- dp_close: '12-31-2022'
36
- },
37
- '20225': {
38
- period: '20225',
39
- description: '2022 Fall',
40
- long_description: 'Fall 2022',
41
- school: 'byuh',
42
- application_open: '09-01-2022',
43
- application_close: '02-01-2023',
44
- dp_close: '04-31-2023'
45
- },
46
- '20231': {
47
- period: '20231',
48
- description: '2023 Winter',
49
- long_description: 'Winter 2023',
50
- school: 'byuh',
51
- application_open: '02-01-2023',
52
- application_close: '06-01-2023',
53
- dp_close: '08-31-2023'
54
- },
55
- '20233': {
56
- period: '20233',
57
- description: '2023 Spring',
58
- long_description: 'Spring 2023',
59
- school: 'byuh',
60
- application_open: '07-01-2022',
61
- application_close: '11-02-2022',
62
- dp_close: '12-31-2023'
63
- },
64
- '20235': {
65
- period: '20235',
66
- description: '2023 Fall',
67
- long_description: 'Fall 2023',
68
- school: 'byuh',
69
- application_open: '09-01-2022',
70
- application_close: '02-02-2023',
71
- dp_close: '04-31-2023'
72
- },
73
- '20241': {
74
- period: '20241',
75
- description: '2024 Winter',
76
- long_description: 'Winter 2024',
77
- school: 'byuh',
78
- application_open: '03-01-2023',
79
- application_close: '07-03-2023',
80
- dp_close: '09-31-2023'
27
+ function semesterCodeToDescription(semesterCode) {
28
+ switch (semesterCode) {
29
+ case '1':
30
+ return 'Winter'
31
+ case '3':
32
+ return 'Spring'
33
+ case '4':
34
+ return 'Summer'
35
+ case '5':
36
+ return 'Fall'
81
37
  }
82
38
  }
83
39
 
@@ -93,6 +49,12 @@ export default {
93
49
  validator (value) {
94
50
  return ['byu', 'byui', 'byuh', 'byupw', 'ldsbc'].includes(value)
95
51
  }
52
+ },
53
+ config: {
54
+ type: Array,
55
+ validator (value) {
56
+ return value.length > 0
57
+ }
96
58
  }
97
59
  },
98
60
  computed: {
@@ -113,80 +75,32 @@ export default {
113
75
  ...mapMutations(['selectAdmitPeriod']),
114
76
  ...mapActions(['preserveUiSettings']),
115
77
  async fetchConfig() {
116
- // This config is hosted in the domain-common-admit-periods repository
117
- /*
118
- Presently, the service storing this configuration is changing from a static s3 site
119
- to the config service to allow admins to update the configuration items themselves.
120
- While that transition happens, we will hard-code these values temporarily.
121
-
122
- const headers = {
123
- accept: 'application/json',
124
- 'content-type': 'application/json'
125
- }
126
- const url = `https://admit-period-vocab-cdn.ces-admissionssupport-prd.amazon.byu.edu/${this.school}-admit-periods.json`
127
- const options = { headers, url }
128
- const r = await window.byu.auth.request(options)
129
- const { status, body } = r
130
- if (status === 0) {
131
- console.error('Something went wrong! CORS?')
132
- }else if (status < 400) {
133
- const response = JSON.parse(body)
134
- console.log(response)
135
- this.admitPeriodList = Object.entries(response).map(([key, value]) => value).sort((a, b) => {
136
- if (!a.dp_close || !b.dp_close) {
137
- // don't modify order if dp_close isn't provided
138
- return 0
139
- }
140
- const da = Date.parse(a.dp_close)
141
- const db = Date.parse(b.dp_close)
142
- return da - db
78
+ const admitPeriods = []
79
+ for (const admitPeriod of this.config) {
80
+ // isolate semester code and semester year
81
+ const semesterYear = admitPeriod.admit_period.substring(0, admitPeriod.admit_period.length - 1)
82
+ const semesterCode = admitPeriod.admit_period.substring(admitPeriod.admit_period.length - 1)
83
+ // add another object to admitPeriods with information from configuration
84
+ admitPeriods.push({
85
+ period: semesterYear + semesterCode,
86
+ description: semesterYear + ' ' + semesterCodeToDescription(semesterCode),
87
+ long_description: semesterCodeToDescription(semesterCode) + ' ' + semesterYear,
88
+ school: 'byuh',
89
+ application_open: admitPeriod.open,
90
+ application_close: admitPeriod.close
143
91
  })
144
- if (!this.selectedAdmitPeriod) {
145
- const mostCurrent = this.admitPeriodList.find(p => {
146
- if (p.dp_close) {
147
- const closeDate = new Date(Date.parse(p.dp_close))
148
- return new Date() < closeDate
149
- } else {
150
- return false
151
- }
152
- })
153
- if (mostCurrent) {
154
- this.selectAdmitPeriod(mostCurrent.period)
155
- }
156
- }
157
- } else if (status === 404) {
158
- console.log('AdmitPeriodConfig - not found for ' + this.school)
159
- } else {
160
- console.error(`Error ${status} while fetching admit period config`)
161
92
  }
162
- */
163
93
 
164
- this.admitPeriodList = Object.entries(admitPeriods).map(([key, value]) => value).sort((a, b) => {
165
- if (!a.dp_close || !b.dp_close) {
166
- // don't modify order if dp_close isn't provided
167
- return 0
168
- }
169
- const da = Date.parse(a.dp_close)
170
- const db = Date.parse(b.dp_close)
171
- return da - db
172
- })
94
+ this.admitPeriodList = admitPeriods
95
+ // select the most recent admit period if none selected
173
96
  if (!this.selectedAdmitPeriod) {
174
- const mostCurrent = this.admitPeriodList.find(p => {
175
- if (p.dp_close) {
176
- const closeDate = new Date(Date.parse(p.dp_close))
177
- return new Date() < closeDate
178
- } else {
179
- return false
180
- }
181
- })
182
- if (mostCurrent) {
183
- this.selectAdmitPeriod(mostCurrent.period)
184
- }
97
+ this.selectedAdmitPeriod(this.admitPeriodList[this.admitPeriodList.length - 1])
185
98
  }
186
99
  },
187
100
  chooseAdmitPeriod (admitPeriod) {
188
101
  this.selectAdmitPeriod(admitPeriod)
189
102
  this.preserveUiSettings()
103
+ this.showList = false
190
104
  }
191
105
  },
192
106
  mounted () {
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [8.34.0](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.33.2...v8.34.0) (2023-08-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * support new format of config data ([5627044](https://github.com/byu-oit/vue-decision-processing-components/commit/5627044847830ba9370b4a2ed26f09a09aab0ba5))
11
+
5
12
  ### [8.33.2](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.33.1...v8.33.2) (2023-07-25)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.33.2",
3
+ "version": "8.34.0",
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",