From b889d2199177ce7711031bc25b170e577efd5851 Mon Sep 17 00:00:00 2001 From: Justin Kleiber Date: Wed, 22 May 2024 00:07:43 -0400 Subject: [PATCH] Adds SAUCE, BRIQUETTE, and RIBS to the website (#39) * Adds the old stats to the website, but not to the ranking page yet * Adds stats to the ranking view and adds some filtering * Updates data scripts to avoid hanging and adds filtering for stats on the ranking page * Adds shorter default timeout to github action jobs * Mobile optimization to the event ranking table --- .github/workflows/update_data.yaml | 3 + src/components/EventDataRow.vue | 27 +++- src/components/StatSummary.vue | 12 +- src/components/TableHeader.vue | 14 +- src/views/EventRankingsView.vue | 247 +++++++++++++++++++++++++---- src/views/EventView.vue | 24 +++ util/data_loader.py | 10 +- util/event_processor.py | 100 ++++++++++-- util/main.py | 4 +- util/supabase_api.py | 11 +- 10 files changed, 398 insertions(+), 54 deletions(-) diff --git a/.github/workflows/update_data.yaml b/.github/workflows/update_data.yaml index 1e356d6..dc3f4bf 100644 --- a/.github/workflows/update_data.yaml +++ b/.github/workflows/update_data.yaml @@ -46,6 +46,7 @@ jobs: name: Load Blue Banners needs: set_up_environment runs-on: ubuntu-latest + timeout-minutes: 30 defaults: run: working-directory: ./util @@ -74,6 +75,7 @@ jobs: name: Load Event Data needs: [set_up_environment, load_blue_banners] runs-on: ubuntu-latest + timeout-minutes: 30 defaults: run: working-directory: ./util @@ -102,6 +104,7 @@ jobs: name: Load Team Data needs: [set_up_environment, load_blue_banners] runs-on: ubuntu-latest + timeout-minutes: 30 defaults: run: working-directory: ./util diff --git a/src/components/EventDataRow.vue b/src/components/EventDataRow.vue index cf0dce5..97deadb 100644 --- a/src/components/EventDataRow.vue +++ b/src/components/EventDataRow.vue @@ -9,8 +9,8 @@ {{ year }} {{ name }} - - {{ stat.value.toFixed(4) }} + + {{ valueDisplay(stat) }} @@ -22,7 +22,8 @@ export default { name: null, year: null, eventId: null, - eventData: null + eventData: null, + columnData: null }, computed: { rankNumberString() { @@ -36,6 +37,26 @@ export default { }, eventAvailable() { return this.eventId != null && this.eventData != null; + }, + visibleData() { + // Default to showing all columns. + let data = this.eventData; + + // If column data is provided, only show the visible columns based on name matching. + if (this.columnData) { + let cols = this.columnData.filter((col) => col.visible == true); + let colNames = cols.map(({ name }) => name); + data = this.eventData.filter((item) => colNames.includes(item.name)); + } + return data; + } + }, + methods: { + valueDisplay(stat) { + if (stat && stat.value) { + return stat.value.toFixed(4); + } + return "N/A"; } } } diff --git a/src/components/StatSummary.vue b/src/components/StatSummary.vue index b9c196f..9d07acf 100644 --- a/src/components/StatSummary.vue +++ b/src/components/StatSummary.vue @@ -16,7 +16,7 @@ ChartJS.register(ArcElement, Tooltip, Legend, Colors, Title) {{ stat.name }}
- {{ stat.value.toFixed(4) }} + {{ valueDisplay(stat) }}
@@ -108,6 +108,12 @@ export default { } }, methods: { + valueDisplay(stat) { + if (stat && stat.value) { + return stat.value.toFixed(4); + } + return "N/A"; + }, convertDictToSortedValueArray(dict) { var items = Object.keys(dict).map(function (key) { return [key, dict[key]]; @@ -202,8 +208,8 @@ export default { } .stat-cell { - max-width: 250px; - min-width: 100px; + width: 250px; + min-width: 25%; margin: 0 auto; } diff --git a/src/components/TableHeader.vue b/src/components/TableHeader.vue index 4ead8ee..4366d88 100644 --- a/src/components/TableHeader.vue +++ b/src/components/TableHeader.vue @@ -4,7 +4,7 @@