diff --git a/backend/src/app.ts b/backend/src/app.ts index ab7193c..31f890e 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -36,8 +36,8 @@ app.post('/api/serverstats/gamestats', jsonParser, async (req, res) => { 'SUM(CASE WHEN status = "Complete" THEN 1 ELSE 0 END) as Complete, ' + 'SUM(CASE WHEN status = "Postponed" THEN 1 ELSE 0 END) as Postponed, ' + 'SUM(CASE WHEN status = "Pending" THEN 1 ELSE 0 END) as Pending, ' + - 'SUM(event) as Events, ' + - 'SUM(fix) as Fixes, ' + + 'SUM(CASE WHEN event = "TRUE" THEN 1 ELSE 0 END) as Events, ' + + 'SUM(CASE WHEN fix = "TRUE" THEN 1 ELSE 0 END) as Fixes, ' + 'SUM(payoutEB) as TotalEB, ' + 'SUM(payoutIP) as TotalIP, ' + 'SUM(payoutEB) / SUM(CASE WHEN status = "Complete" THEN 1 ELSE 0 END) as AverageEB, ' + diff --git a/frontend/src/App.vue b/frontend/src/App.vue index e37e74e..1daed69 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -5,7 +5,6 @@ Server Stats Games Characters - GMs diff --git a/frontend/src/vues/ServerStats.vue b/frontend/src/vues/ServerStats.vue index 4c14692..f08f8b8 100644 --- a/frontend/src/vues/ServerStats.vue +++ b/frontend/src/vues/ServerStats.vue @@ -11,6 +11,10 @@ Postponed Games {{ gameStats.Postponed }} +
+ Events / Fixes + {{ gameStats.Events }} / {{ gameStats.Fixes }} +
Total / Average EB Role - Characters - App Count - Games Played - % Games With Role + Active + App Count + Games Played + Pick Rate % + % Games With Role {{ roleName }} - {{ roleStat.active }} - {{ roleStat.apps }} - {{ roleStat.picks }} - + {{ roleStat.active }} + {{ roleStat.apps }} + {{ roleStat.picks }} + {{ Math.floor((roleStat.picks / roleStat.apps) * 100) }}% + {{ Math.floor((roleStat.picks / gameStats.Complete) * 100) }}% @@ -94,12 +100,13 @@ const dateSelect = ref(-1) const dateItems = buildDateItems() -const chartSelect = ref("active") +const chartSelect = ref('active') const chartItems = [ - {title: "Active Characters", value: "active"}, - {title: "Role Picks", value: "picks"}, - {title: "Role Applications", value: "apps"} + { title: 'Game Types', value: 'gametypes' }, + { title: 'Active Characters', value: 'active' }, + { title: 'Role Picks', value: 'picks' }, + { title: 'Role Applications', value: 'apps' } ] const gameStats = ref({}) @@ -146,14 +153,32 @@ function dateToMonthId(date: Date) { } function updateChart(stats, tag) { - chart.data = { - labels: Object.keys(stats), - datasets: [ - { - label: tag, - data: Object.values(stats).map((p) => p[tag]) - } - ] + if (tag === 'gametypes') { + chart.data = { + labels: ['Standard', 'Postponed', 'Pending', 'Event', 'Fix'], + datasets: [ + { + label: 'Game Type', + data: [ + gameStats.value.Complete - gameStats.value.Events - gameStats.value.Fixes, + gameStats.value.Postponed, + gameStats.value.Pending, + gameStats.value.Events, + gameStats.value.Fixes + ] + } + ] + } + } else { + chart.data = { + labels: Object.keys(stats), + datasets: [ + { + label: tag, + data: Object.values(stats).map((p) => p[tag]) + } + ] + } } chart.update() } @@ -167,7 +192,6 @@ watch(roleStats, async (newValue, oldValue) => { }) watch(chartSelect, async (newValue, oldValue) => { - updateChart(roleStats.value, newValue) })