Skip to content

Commit

Permalink
Merge pull request #60 from Sun-Mountain/59-bug-fix-auto-update-genco…
Browse files Browse the repository at this point in the history
…n-list

59 - auto gen bug
  • Loading branch information
Sun-Mountain authored Jul 25, 2023
2 parents a455399 + b3efae6 commit 0b82020
Show file tree
Hide file tree
Showing 14 changed files with 755 additions and 59 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/auto-tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Minor version for each merge
- name: Dry Run
id: taggerDryRun
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DRY_RUN: true
DEFAULT_BUMP: patch

- name: echo new tag
run: |
Expand All @@ -27,7 +28,7 @@ jobs:
- name: echo part
run: |
echo "The version increment was: ${{ steps.taggerDryRun.outputs.part }}"
- name: Minor version for each merge
- name: Tag Real
id: taggerFinal
uses: anothrNick/[email protected]
env:
Expand Down
43 changes: 22 additions & 21 deletions .github/workflows/import-gencon-events.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Import GenCon Events

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
inputs:
environment:
Expand All @@ -21,37 +23,24 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install convert-excel-to-json
run: npm install -g convert-excel-to-json
- name: Rename event.json
run: mv -i ./frontend/assets/events/events.json ./frontend/assets/events/events-${{ env.STORED_DATE }}.json
- name: Find oldest file
run: echo "OLDEST_FILE=$( find ./frontend/assets/events -type f | sort | head -n 1)" >> $GITHUB_ENV
- name: Find newest file
run: echo "NEWEST_FILE=$( find ./frontend/assets/events -type f | sort | tail -n 1)" >> $GITHUB_ENV
run: mv -i ./frontend/assets/events/events.json ./frontend/assets/events/events2.json
- name: Remove raw data file
uses: EndBug/add-and-commit@v9
with:
remove: './frontend/assets/events/rawEvents.json'
- name: Download zip file
run: curl https://www.gencon.com/downloads/events.zip -L -o events.zip
- name: Unzip file
run: 7z x events.zip
- name: Install convert-excel-to-json
run: npm install -g convert-excel-to-json
- name: Convert to JSON
run: convert-excel-to-json --sourceFile="events.xlsx" > ./frontend/assets/events/events.json
run: convert-excel-to-json --sourceFile="events.xlsx" > ./frontend/assets/events/rawEvents.json
- name: Add new file
uses: EndBug/add-and-commit@v9
with:
add: './frontend/assets/events/events.json'
- name: Count files
run: echo "FILE_COUNT=$(find ./frontend/assets/events ls | wc -l)" >> $GITHUB_ENV
- name: Remove oldest file
if: ${{ env.FILE_COUNT }} > 2
uses: EndBug/add-and-commit@v9
with:
remove: '${{ env.OLDEST_FILE }}'
- name: Update last updated date
uses: jossef/[email protected]
with:
file: ./frontend/assets/events/lastUpdate.json
field: date
value: ${{ env.STORED_DATE }}
- name: Remove xlsx file
uses: EndBug/add-and-commit@v9
with:
Expand All @@ -60,3 +49,15 @@ jobs:
uses: EndBug/add-and-commit@v9
with:
remove: 'events.zip'
- name: Run ParseData.js
run: node ./frontend/modules/parseData.js > ./frontend/assets/events/events.json
- name: Add new file
uses: EndBug/add-and-commit@v9
with:
add: './frontend/assets/events/events.json'
- name: Update last updated date
uses: jossef/[email protected]
with:
file: ./frontend/assets/events/lastUpdate.json
field: date
value: ${{ env.STORED_DATE }}
3 changes: 2 additions & 1 deletion frontend/assets/events/events.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/assets/events/lastUpdate.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"date": "20230724011611"
"date": "20230725181224"
}
2 changes: 1 addition & 1 deletion frontend/assets/events/rawEvents.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/components/DailyTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function DailyTabs({
};

const getEvents = (day: string) => {
const dayEvents = eventsListByDay[day]
const dayEvents = eventsListByDay[day];
var eventsForDay = dayEvents;

if (Number(durationKeys[0]) != lowestDuration || Number(durationKeys[durationKeys.length - 1]) != highestDuration) {
Expand Down
27 changes: 0 additions & 27 deletions frontend/helpers/parsingHelpers.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
import EventData from '@/assets/events/events.json';
import { cleanData, getFirstKey } from '@/helpers';

export default function parseData () {
const rawData = EventData as any;

// Values of first Key
const firstKey = getFirstKey(rawData)
const jsonString = JSON.stringify(rawData[firstKey]);
const rawJsonValues = JSON.parse(jsonString);

// Get labels
const keyRow = getFirstKey(rawJsonValues)
const labelKey = rawJsonValues[keyRow]
labelKey.freeze

// Remove label level
delete rawJsonValues[keyRow];

// Events list
const rawEventsList = rawJsonValues;

const cleanedData = cleanData({ keyList: labelKey, eventList: rawEventsList });

return cleanedData
};

export const parseDate = (dateString: string) => {
const year = dateString.substring(0,4);
const month = dateString.substring(4, 6);
Expand Down
Loading

1 comment on commit 0b82020

@vercel
Copy link

@vercel vercel bot commented on 0b82020 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.