Skip to content

Commit 63db3ee

Browse files
author
Andraz Vrhovec
committed
upgrade vue-cli-service
1 parent d8888a3 commit 63db3ee

File tree

8 files changed

+1239
-980
lines changed

8 files changed

+1239
-980
lines changed

.eslintrc

-11
This file was deleted.

.eslintrc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
extends: [
3+
"plugin:vue/essential"
4+
],
5+
plugins: [
6+
"mocha"
7+
],
8+
parserOptions: {
9+
ecmaFeatures: {
10+
jsx: true,
11+
modules: true
12+
}
13+
}
14+
}

babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
presets: [
3-
'@vue/app'
3+
'@vue/cli-plugin-babel/preset'
44
]
55
}

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"axios": "^0.19.2",
1616
"bootstrap-vue": "^2.7.0",
1717
"chart.js": "^2.9.3",
18-
"core-js": "^2.6.5",
18+
"core-js": "^3.6.4",
1919
"d3": "^5.15.0",
2020
"date-fns": "^2.11.1",
2121
"highcharts": "^8.0.4",
@@ -34,15 +34,15 @@
3434
"vuex": "^3.1.3"
3535
},
3636
"devDependencies": {
37-
"@vue/cli-plugin-babel": "^3.0.4",
38-
"@vue/cli-plugin-eslint": "^3.0.4",
37+
"@vue/cli-plugin-babel": "~4.3.1",
38+
"@vue/cli-plugin-eslint": "~4.3.1",
3939
"@vue/cli-plugin-unit-mocha": "^4.3.1",
40-
"@vue/cli-service": "^3.0.4",
41-
"babel-eslint": "^10.0.1",
40+
"@vue/cli-service": "~4.3.1",
41+
"babel-eslint": "^10.1.0",
4242
"chai": "^4.2.0",
43-
"eslint": "^5.16.0",
43+
"eslint": "^6.7.2",
4444
"eslint-plugin-mocha": "^6.3.0",
45-
"eslint-plugin-vue": "^5.0.0",
45+
"eslint-plugin-vue": "^6.2.2",
4646
"fable-compiler": "^2.4.22",
4747
"fable-loader": "^2.1.9",
4848
"html-loader": "^1.0.0",

src/components/Footer.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
</template>
2323

2424
<script>
25-
export default {};
25+
export default {
26+
name: "Footer"
27+
};
2628
</script>
2729

2830
<style scopped lang="sass">

src/store.js

+52-50
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,62 @@ async function exportTime(url) {
1212
}
1313

1414
export function lastChange(data, field) {
15-
16-
const lastLastValue = data.slice().reverse().find(row => {
17-
return row[field]
18-
})
19-
20-
if (!lastLastValue) {
21-
return {
22-
lastDay: {
23-
date: new Date(),
24-
value: 0,
25-
diff: 0,
26-
percentDiff: 0
27-
},
28-
dayBefore: {
29-
date: new Date(),
30-
value: 0,
31-
diff: 0,
32-
percentDiff: 0
33-
},
15+
16+
const result = {
17+
lastDay: {
18+
date: new Date(),
19+
fistDate: undefined,
20+
value: undefined,
21+
diff: undefined,
22+
percentDiff: undefined
23+
},
24+
dayBefore: {
25+
date: new Date(),
26+
fistDate: undefined,
27+
value: undefined,
28+
diff: undefined,
29+
percentDiff: undefined
30+
},
31+
day2Before: {
32+
date: new Date(),
33+
value: undefined,
3434
}
3535
}
3636

37-
const lastValue = data.slice().reverse().find(row => {
38-
return row[field] == lastLastValue[field]
39-
})
4037

41-
const previousValue = data.slice().reverse().find(row => {
42-
return row[field] != lastValue[field] && Date.parse(row['date']) < Date.parse(lastValue['date'])
43-
})
44-
const prePreviousValue = data.slice().reverse().find(row => {
45-
return row[field] != previousValue[field] && Date.parse(row['date']) < Date.parse(previousValue['date'])
46-
})
38+
// result.lastDay.date = new Date(data[data.length - 1]['date'])
39+
// result.lastDay.value = data[data.length - 1][field]
4740

48-
const lastDayValue = lastValue[field] || null
49-
const dayBeforeValue = previousValue[field] || null
41+
let i = data.length
5042

51-
const lastDayDiff = lastValue[field] - previousValue[field]
52-
const dayBeforeDiff = previousValue[field] - prePreviousValue[field]
53-
54-
const lastDayPercentDiff = lastDayDiff != 0 ? Math.round((lastDayDiff / dayBeforeValue) * 1000) / 10 : 0
43+
while(i > 0 && data[i][field] == null) i--
44+
result.lastDay.date = new Date(data[i]['date'])
45+
result.lastDay.value = data[i][field]
5546

56-
return {
57-
lastDay: {
58-
date: lastValue ? new Date(Date.parse(lastValue.date)) : null,
59-
value: lastDayValue,
60-
diff: lastDayDiff,
61-
percentDiff: lastDayPercentDiff,
62-
},
63-
dayBefore: {
64-
date: previousValue ? new Date(Date.parse(previousValue.date)) : null,
65-
value: dayBeforeValue,
66-
diff: dayBeforeDiff,
67-
}
68-
}
47+
while(i > 0 && result.lastDay.value === data[i][field]) i--
48+
result.lastDay.fistDate = new Date(data[i+1]['date'])
49+
50+
while(i > 0 && data[i][field] == null) i--
51+
result.dayBefore.date = new Date(data[i]['date'])
52+
result.dayBefore.value = data[i][field]
53+
54+
while(i > 0 && result.dayBefore.value === data[i][field]) i--
55+
result.dayBefore.fistDate = new Date(data[i+1]['date'])
56+
57+
while(i > 0 && data[i][field] == null) i--
58+
result.day2Before.date = new Date(data[i]['date'])
59+
result.day2Before.value = data[i][field]
60+
61+
// while(i > 0 && result.dayBefore.value === data[i][field]) i--
62+
// result.day2Before.fistDate = new Date(data[i+1]['date'])
63+
64+
result.lastDay.diff = result.lastDay.value - result.dayBefore.value
65+
result.lastDay.percentDiff = result.dayBefore.value ? Math.round((result.lastDay.diff / result.dayBefore.value) * 1000) / 10 : 0
66+
67+
result.dayBefore.diff = result.dayBefore.value - result.day2Before.value
68+
result.dayBefore.percentDiff = result.day2Before.value ? Math.round((result.dayBefore.diff / result.day2Before.value) * 1000) / 10 : 0
69+
70+
return result
6971
}
7072

7173
const statsStore = {
@@ -88,7 +90,7 @@ const statsStore = {
8890
return {}
8991
}
9092
let searchResult = getters.data.find(day => {
91-
return new Date(Date.parse(day.date)).setHours(0,0,0,0) === date.getTime()
93+
return new Date(Date.parse(day.date)).setHours(0, 0, 0, 0) === date.getTime()
9294
})
9395
return { date, value: searchResult ? searchResult[field] : null }
9496
},
@@ -168,7 +170,7 @@ const hospitalsStore = {
168170
return {}
169171
}
170172
let searchResult = getters.data.find(day => {
171-
return new Date(Date.parse(day.date)).setHours(0,0,0,0) === date.getTime()
173+
return new Date(Date.parse(day.date)).setHours(0, 0, 0, 0) === date.getTime()
172174
})
173175
return { date, value: searchResult ? searchResult[field] : null }
174176
},
@@ -195,7 +197,7 @@ const hospitalsStore = {
195197
});
196198
return row
197199
});
198-
200+
199201

200202
let hospitals = {}
201203
let rawData = await d3.csv("https://raw.githubusercontent.com/slo-covid-19/data/master/csv/dict-hospitals.csv")

0 commit comments

Comments
 (0)