@byu-oit/vue-decision-processing-components 8.27.2 → 8.27.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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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.27.3](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.2...v8.27.3) (2022-06-29)
6
+
5
7
  ### [8.27.2](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.1...v8.27.2) (2022-06-24)
6
8
 
7
9
 
@@ -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>
@@ -72,11 +72,34 @@ import { sat2ActFilter } from './sat2Act'
72
72
  export default {
73
73
  name: 'DetailsTestScores',
74
74
  computed: {
75
- ...mapGetters([ 'testScores' ])
75
+ ...mapGetters([ 'testScores' ]),
76
+
77
+ orderedTestScores() {
78
+ // sort test scores by test date
79
+ const scores = this.testScores.sort((a, b) => {
80
+ if (!a.testDate) return 1
81
+ if (a.testDate > b.testDate) return 1
82
+ else return 0
83
+ })
84
+
85
+ // sort 'reading' before 'listening' for TOEFL test
86
+ for (let score of scores) {
87
+ if (!score.testComponents || score.testName !== 'TOEFL') continue
88
+ score.testComponents = score.testComponents.sort((a, b) => {
89
+ if (a.name === 'listening' && b.name === 'reading') return 1
90
+ return 0
91
+ })
92
+ }
93
+ return scores
94
+ }
76
95
  },
77
96
  filters: {
78
97
  dateFormat,
79
- sat2ActFilter
98
+ sat2ActFilter,
99
+ removeLeadingZeros: function (value) {
100
+ if ( (!value) || !(/^\d+$/.test(value)) ) return value // leave as is if not a string of numbers
101
+ return parseInt(value, 10) // remove leading zeros
102
+ }
80
103
  }
81
104
  }
82
105
  </script>
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.27.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",