@byu-oit/vue-decision-processing-components 8.27.2 → 8.28.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
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.28.0](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.4...v8.28.0) (2022-07-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * filter reports from new app svc based on institution -- WIP ([b64110a](https://github.com/byu-oit/vue-decision-processing-components/commit/b64110af2bef04c2185e3d96ee47aaf4aeda5339))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * make a spot for institution in the vuex store ([bbf1e45](https://github.com/byu-oit/vue-decision-processing-components/commit/bbf1e45aeaa78bd62250e1af018c488b9b7ccb97))
16
+ * reports in the new application service that are requested through a proxy call have a different url pattern ([d781980](https://github.com/byu-oit/vue-decision-processing-components/commit/d7819803dde7cc8ba4104355f8f54005be4a1126))
17
+
18
+ ### [8.27.4](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.3...v8.27.4) (2022-07-13)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * sorting of test scores (was comparing strings instead of dates) ([308fb72](https://github.com/byu-oit/vue-decision-processing-components/commit/308fb728f1a5eb525472d2e438d5ddd787f09771))
24
+
25
+ ### [8.27.3](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.2...v8.27.3) (2022-06-29)
26
+
5
27
  ### [8.27.2](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.1...v8.27.2) (2022-06-24)
6
28
 
7
29
 
@@ -25,7 +25,7 @@
25
25
  </tr>
26
26
  </thead>
27
27
  <tbody>
28
- <tr v-for="(ts, i) in testScores">
28
+ <tr v-for="(ts, i) in orderedTestScores">
29
29
  <td>
30
30
  {{ts.testName}}
31
31
  <template v-if="ts.selfReported">
@@ -45,7 +45,7 @@
45
45
  <span class="bold">({{ts.compositeScore | sat2ActFilter}} ACT)</span>
46
46
  </td>
47
47
  <td v-else class="composite">
48
- <span class="badge badge-primary x-lg">{{ts.compositeScore}}</span>
48
+ <span class="badge badge-primary x-lg">{{ts.compositeScore | removeLeadingZeros}}</span>
49
49
  </td>
50
50
  <td>
51
51
  <table class="table table-borderless table-sm" v-if="ts.testComponents.length > 0">
@@ -53,7 +53,7 @@
53
53
  <th v-for="sub in ts.testComponents" :key="sub.name">{{sub.name}}</th>
54
54
  </thead>
55
55
  <tbody>
56
- <td v-for="sub in ts.testComponents" :key="sub.name">{{sub.score}}</td>
56
+ <td v-for="sub in ts.testComponents" :key="sub.name">{{sub.score | removeLeadingZeros}}</td>
57
57
  </tbody>
58
58
  </table>
59
59
  </td>
@@ -69,14 +69,50 @@ import { mapGetters } from 'vuex'
69
69
  import { dateFormat } from './dateTimeFormat'
70
70
  import { sat2ActFilter } from './sat2Act'
71
71
 
72
+ function yearMonth2Date (yearMonth) {
73
+ if (!/^[0-9]{4}-[0-9]{2}$/.test(yearMonth)) {
74
+ return yearMonth
75
+ }
76
+ const year = yearMonth.slice(0, 4)
77
+ const month = yearMonth.slice(5, 7)
78
+ return new Date(year, parseInt(month) - 1)
79
+ }
80
+
72
81
  export default {
73
82
  name: 'DetailsTestScores',
74
83
  computed: {
75
- ...mapGetters([ 'testScores' ])
84
+ ...mapGetters([ 'testScores' ]),
85
+
86
+ orderedTestScores() {
87
+ // sort test scores by test date
88
+ const scores = this.testScores.slice().sort((a, b) => {
89
+ const dt1 = yearMonth2Date(a.testDate)
90
+ const dt2 = yearMonth2Date(b.testDate)
91
+ if (!dt1 instanceof Date && !dt2 instanceof Date) return 0
92
+ if (!dt1 instanceof Date) return 1
93
+ if (!dt2 instanceof Date) return -1
94
+
95
+ return dt1 < dt2 ? 1 : -1
96
+ })
97
+
98
+ // sort 'reading' before 'listening' for TOEFL test
99
+ for (let score of scores) {
100
+ if (!score.testComponents || score.testName !== 'TOEFL') continue
101
+ score.testComponents = score.testComponents.sort((a, b) => {
102
+ if (a.name === 'listening' && b.name === 'reading') return 1
103
+ return 0
104
+ })
105
+ }
106
+ return scores
107
+ }
76
108
  },
77
109
  filters: {
78
110
  dateFormat,
79
- sat2ActFilter
111
+ sat2ActFilter,
112
+ removeLeadingZeros: function (value) {
113
+ if ( (!value) || !(/^\d+$/.test(value)) ) return value // leave as is if not a string of numbers
114
+ return parseInt(value, 10) // remove leading zeros
115
+ }
80
116
  }
81
117
  }
82
118
  </script>
package/Report.vue CHANGED
@@ -169,6 +169,12 @@ export default {
169
169
  if (this.metadata.parameters.includes('setById')) {
170
170
  q.append('set_by_id', this.setById)
171
171
  }
172
+ // appends institution if available to url search params
173
+ if(this.metadata.parameters.includes('institutions')) {
174
+ if(this.metadata.parameters.institutions.includes(state.institution))
175
+ q.append('institution', state.institution)
176
+ }
177
+
172
178
  const url = this.baseUrl + '?' + q.toString()
173
179
  const loadRequested = () => {
174
180
  let promises = []
package/ReportList.vue CHANGED
@@ -53,20 +53,22 @@ export default {
53
53
  },
54
54
  computed: {
55
55
  ...mapState({
56
- reports: state => state.reports.list
56
+ reports: state => state.reports.list,
57
+ institution: state => state.ui.institution
57
58
  }),
58
59
  categories () {
59
- const reports = this.reports
60
+ let reports = this.reports
61
+ // Filters reports to have reports specefic to dp institution
62
+ reports.filter(ins => ins.institution.includes(state.institution)).map(ins => ins.institution)
60
63
  const allObjectCategories = reports.map(o => o.category)
61
- const addToSet = (set, o) => set.add(o)
62
- const uniqueCategories = Array.from(allObjectCategories.reduce(addToSet, new Set()))
64
+ let uniqueCategories = new Set()
65
+ allObjectCategories.forEach((category) => uniqueCategories.add(category))
63
66
  return uniqueCategories.filter(c => c && c !== 'system')
64
67
  }
65
68
  },
66
69
  methods: {
67
70
  reportsWithCategory(category) {
68
- const allReports = Object.values(this.reports)
69
- return allReports.filter(o => o.category === category)
71
+ return this.reports.filter(o => o.category === category)
70
72
  }
71
73
  }
72
74
  }
package/ReportViewer.vue CHANGED
@@ -40,7 +40,7 @@
40
40
  <Report
41
41
  v-if="selectedReport"
42
42
  :report-name="selectedReport.name"
43
- :base-url="selectedReport.appService ? appBaseUrl : packetBaseUrl"
43
+ :base-url="calculatedBaseUrl"
44
44
  :detail="showDetail"
45
45
  :chart="showChart"
46
46
  />
@@ -94,6 +94,18 @@ export default {
94
94
  } else {
95
95
  return false
96
96
  }
97
+ },
98
+ calculatedBaseUrl () {
99
+ let reportUrl = ''
100
+ if (this.selectedReport.appService) {
101
+ reportUrl = this.appBaseUrl
102
+ } else {
103
+ reportUrl = this.packetBaseUrl
104
+ }
105
+ if (this.selectedReport.proxy) {
106
+ reportUrl = reportUrl + '/proxy'
107
+ }
108
+ return reportUrl + '/report'
97
109
  }
98
110
  },
99
111
  methods: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.27.2",
3
+ "version": "8.28.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",
@@ -1,13 +1,13 @@
1
1
  'use strict'
2
2
  /*
3
- * Converts array of reportMetadata objects into an object with the report name as their key.
4
- * example reports.admitCandidates = metadata for the admitCandidates report.
5
- *
6
- * use case: to retrieve meta-data from state for a single report.
3
+ * Add a field to each report metadata item that remembers if it's part
4
+ * of the application service (so that we can call the right service
5
+ * when we retrieve the report data)
7
6
  */
8
- export default function parse (reportMetadata, appService) {
7
+ export default function parse (reportMetadata, appService = false, proxy = false) {
9
8
  reportMetadata.values.forEach(function (element) {
10
- element['appService'] = appService
9
+ element.appService = appService
10
+ element.proxy = proxy
11
11
  })
12
12
  return reportMetadata.values
13
13
  }
@@ -2,13 +2,15 @@ const KEY = 'edu.byu.dp.hawaii.ui'
2
2
 
3
3
  export const state = {
4
4
  viewedApplications: [],
5
- admitPeriod: ''
5
+ admitPeriod: '',
6
+ institution: ''
6
7
  }
7
8
 
8
9
  export const mutations = {
9
10
  resetUi (state) {
10
11
  state.viewedApplications = []
11
12
  state.admitPeriod = ''
13
+ state.institution = ''
12
14
  },
13
15
  setUi (state, ui) {
14
16
  if (Array.isArray(ui.viewedApplications)) {
@@ -17,6 +19,9 @@ export const mutations = {
17
19
  if (ui.admitPeriod !== undefined) {
18
20
  state.admitPeriod = ui.admitPeriod
19
21
  }
22
+ if (ui.institution !== undefined) {
23
+ state.institution = ui.institution
24
+ }
20
25
  },
21
26
  viewApplication (state, { appId, name }) {
22
27
  if (state.viewedApplications.find(i => i.appId === appId)) {
@@ -30,6 +35,9 @@ export const mutations = {
30
35
  },
31
36
  selectAdmitPeriod (state, admitPeriod) {
32
37
  state.admitPeriod = admitPeriod
38
+ },
39
+ setInstitution (state, institution) {
40
+ state.institution = institution
33
41
  }
34
42
  }
35
43