Skip to content

Commit

Permalink
Merge pull request #256 from CodeForNagasaki/development
Browse files Browse the repository at this point in the history
maste <- develop
  • Loading branch information
sugasaki authored Apr 25, 2020
2 parents de2a7e9 + 2d33612 commit 0e84794
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
},
computed: {
data() {
const releaseDate = this.$store.state.lastUpdate
const releaseDate = this.$store.getters.lastUpdate
const attributes = this.$store.state.attributes
// 初期値を作成
Expand Down
50 changes: 5 additions & 45 deletions brigade/nagasaki/components/cards/ConfirmedCasesDetailsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,55 +59,15 @@ export default {
// },
computed: {
updatedAt() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
},
confirmedCases() {
// 検査陽性者の状況
const patientsNotCruise = this.$store.state.patientsNotCruise
// console.log(patientsNotCruise, 'patientsNotCruise')
// if (!patientsNotCruise) return formatConfirmedCases(summary)
const summary = Data.main_summary
// console.log(summary, 'summary')
const allCount = this.$store.state.allCount
const number = patientsNotCruise.length
const taiin = this.$store.state.patientsNotCruise.filter(
d => d.退院済フラグ === '1'
).length
const dead = this.$store.state.patientsNotCruise.filter(
d => d.死亡フラグ === '1'
).length
// console.log(taiin, 'taiin')
// 検査実施 人数
summary.value = allCount
// 陽性者数 (累積)
summary.children[0].value = number
const summary = this.$store.state.patientsNotCruise
// console.log(summary, 'summary')
// 入院中
summary.children[0].children[0].value = number - taiin
// 軽症
summary.children[0].children[0].children[0].value = 0
// 重症
summary.children[0].children[0].children[1].value = 0
// 退院
summary.children[0].children[1].value = taiin
// 死亡
summary.children[0].children[2].value = dead
const confirmedCases = formatConfirmedCases(summary)
// console.log(confirmedCases, 'confirmedCases')
return confirmedCases
// 検査陽性者の状況
if (!summary) return formatConfirmedCases(Data.main_summary)
return summary
}
},
methods: {}
Expand Down
38 changes: 13 additions & 25 deletions brigade/nagasaki/components/cards/ConfirmedCasesNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</template>

<script>
import Data from '@/brigade/nagasaki/data/data.json'
import formatGraph from '@/utils/formatGraph'
import TimeBarChart from '@/components/TimeBarChart.vue'
Expand All @@ -37,37 +38,24 @@ export default {
},
computed: {
lastUpdate() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
},
patientsGraph() {
const kensaDates = this.$store.state.kensaDates.map(x => x)
const groups = this.$store.state.groupsNotCruise
// console.log(kensaDates, 'kensaDates')
// console.log(groups, 'groups')
// デフォルト値をセット
let patientsGraphNotCruise = Data.patients_summary.data
if (!groups)
return {
lastUpdate: '',
patientsGraph: [
{ label: '2020/04/20', transition: 1, cumulative: '' }
]
}
// ロード
if (this.$store.state.patientsGraphNotCruise.length !== 0)
patientsGraphNotCruise = this.$store.state.patientsGraphNotCruise.map(
x => x
)
// console.log(patientsGraphNotCruise, 'patientsGraphNotCruise')
// 陽性患者の属性が更新されていて、検査実施数が更新されていない場合の対処
// const found = kensaDates.find(element => element === lastUpdate)
// if (found == null) kensaDates.push(lastUpdate)
// console.log(kensaDates, 'kensaDates2')
// 検査数データを作成
const patients = kensaDates.map(item => {
return {
日付: item,
小計: groups[item] ? groups[item].length : 0
}
})
const result = formatGraph(patientsGraphNotCruise)
// console.log(result, 'result')
// 感染者数グラフ
return formatGraph(patients)
return result
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions brigade/nagasaki/components/cards/TestedNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export default {
},
computed: {
lastUpdate() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
? this.$store.getters.lastUpdate
: '2020-03-14'
},
inspectionsGraph() {
Expand All @@ -57,7 +59,7 @@ export default {
inspectionsLabels() {
const bodik = this.$store.state.testedNumber
const ret = bodik.map(item => dayjs(item.年月日).format('M-DD'))
const ret = bodik.map(item => dayjs(item.年月日).format('M/DD'))
return ret
}
}
Expand Down
16 changes: 10 additions & 6 deletions brigade/nagasaki/data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@
"date": "",
"data": [ {
"リリース日": "2020-03-14T08:00:00.000Z",
"居住地": "壱岐市",
"年代": "30代",
"性別": "男性",
"退院": "",
"居住地": "",
"年代": "",
"性別": "",
"退院": "",
"date": "2020-03-14"
}]
},
"patients_summary": {
"date": "",
"data": []
"date": "2020-03-14T08:00:00.000Z",
"data": [
{
"日付": "2020-03-14T08:00:00.000Z",
"小計": 0
}]
},
"discharges_summary": {
"date": "",
Expand Down
4 changes: 2 additions & 2 deletions components/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export default Vue.extend({
default: ''
},
height: {
type: String,
default: ''
type: Number,
default: 0
},
titleId: {
type: String,
Expand Down
2 changes: 2 additions & 0 deletions components/TimeBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayInfo() {
if (this.dataKind === 'transition') {
// if (!this.chartData.slice(-1)[0]) return ""
return {
lText: `${this.chartData.slice(-1)[0].transition.toLocaleString()}`,
sText: `${this.chartData.slice(-1)[0].label} ${this.$t(
Expand Down
3 changes: 3 additions & 0 deletions components/TimeStackedBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
displayOption() {
const unit = this.unit
const sumArray = this.eachArraySum(this.chartData)
const data = this.chartData
const cumulativeData = this.chartData.map(item => {
return this.cumulative(item)
Expand All @@ -351,6 +352,8 @@ const options: ThisTypedComponentOptionsWithRecordProps<
label: tooltipItem => {
let casesTotal, cases
if (this.dataKind === 'transition') {
if (!sumArray[tooltipItem.index!]) return ''
casesTotal = sumArray[tooltipItem.index!].toLocaleString()
cases = data[tooltipItem.datasetIndex!][
tooltipItem.index!
Expand Down
4 changes: 2 additions & 2 deletions pages/cards/_card copy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export default {
},
computed: {
lastUpdate() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
},
updatedAt() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
}
},
async mounted() {
Expand Down
4 changes: 2 additions & 2 deletions pages/cards/_card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export default {
},
computed: {
lastUpdate() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
},
updatedAt() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
}
},
async mounted() {
Expand Down
14 changes: 7 additions & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ export default Vue.extend({
TestedNumberCard,
HealthCenterCard
},
async fetch({ store, app: { $axios } }) {
// ビルド時のデータを取得してJSに埋め込む
// if (process.server) await store.dispatch('GET_BODIK_AXIOS', $axios)
await store.dispatch('GET_BODIK_AXIOS', $axios)
},
data() {
const data = {
Data,
Expand All @@ -91,15 +86,20 @@ export default Vue.extend({
},
computed: {
lastUpdate() {
return this.$store.state.lastUpdate
return this.$store.getters.lastUpdate
},
updatedAt() {
return convertDatetimeToISO8601Format(this.$data.Data.lastUpdate)
}
},
// async fetch({ store, app: { $axios } }) {
// // ビルド時のデータを取得してJSに埋め込む
// // if (process.server) await store.dispatch('GET_BODIK_AXIOS', $axios)
// // await store.dispatch('GET_BODIK_AXIOS', $axios)
// },
async mounted() {
// 動的に最新情報を取得する
await sleep(1000)
await sleep(100)
await this.$store.dispatch('GET_BODIK_JSONP')
},
head(): MetaInfo {
Expand Down
4 changes: 4 additions & 0 deletions services/bodikApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ const nagasakiPrefectureConfirmedCasesId =
'de7ce61e-1849-47a1-b758-bca3f809cdf8'
const nagasakiCityNewsId = 'eb0ba50a-7a97-4029-9b75-9c6bab0568f6'

const aonyMouseId = '438f03f1-0ee8-466d-a5d9-e874f5367507'

export const fetchNagasakiPrefectureTestedCases = () =>
callFetchJsonp(baseUrl, nagasakiPrefectureTestedCasesId)
export const fetchNagasakiPrefectureConfirmedCases = () =>
callFetchJsonp(baseUrl, nagasakiPrefectureConfirmedCasesId)
export const fetchNagasakiCityNews = () =>
callFetchJsonp(baseUrl, nagasakiCityNewsId)

export const fetchonyMouseId = () => callFetchJsonp(baseUrl, aonyMouseId)

export const axiosNagasakiPrefectureTestedCases = axios =>
axios.$get(baseUrl + nagasakiPrefectureTestedCasesId)
export const axiosNagasakiPrefectureConfirmedCases = axios =>
Expand Down
Loading

0 comments on commit 0e84794

Please sign in to comment.