@byu-oit/vue-decision-processing-components 8.27.3 → 8.27.4

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,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.27.4](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.3...v8.27.4) (2022-07-13)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * sorting of test scores (was comparing strings instead of dates) ([308fb72](https://github.com/byu-oit/vue-decision-processing-components/commit/308fb728f1a5eb525472d2e438d5ddd787f09771))
11
+
5
12
  ### [8.27.3](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.2...v8.27.3) (2022-06-29)
6
13
 
7
14
  ### [8.27.2](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.27.1...v8.27.2) (2022-06-24)
@@ -69,6 +69,15 @@ 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: {
@@ -76,10 +85,14 @@ export default {
76
85
 
77
86
  orderedTestScores() {
78
87
  // 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
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
83
96
  })
84
97
 
85
98
  // sort 'reading' before 'listening' for TOEFL test
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.27.3",
3
+ "version": "8.27.4",
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",