This is a quick overview of how to deal with data (input data, db, backup/restore)
-
google sheet
orexcel
files for definitions (example: https://docs.google.com/spreadsheets/d/1Ax-EIuKVjAHVa0QG8diFmNAYTSgnSU8DpqN1bcepXhg/edit?usp=sharing)rope-skipping Competition folder: https://drive.google.com/drive/folders/1nqsbfqPq71v_VZ8rc1NEBC53z-l4YrJj
-
./frontend/src/lib/reportDefinitions.ts (yes, that is ugly, but the pain to change it has not yet been high enough ;-) )
- the data is stored in the postgresql database. you can use any postgres db tool e.g. dbeaver.
- the exception is ./frontend/src/lib/reportDefinitions.ts which is in the code.
- the RawPoints at runtime are additionally stored in json files in order to have a backup, if something would happen to the db. with the master-data and the RawPoints, all the Results can be recalculated.
planning the tournament
- if master data has changed (change in categories etc.) -> follow: import master data
- upload the new tournament -> follow: import tournament data
just before the tournament
-
update the current tournament: backend/.env
# get `tournamentName`s curl --location 'http://192.168.77.21:8080/api/tournaments' CURRENT_TOURNAMENT=<name of the current tournament> # must correspond with one of the listed tournamentName
-
empty the backup folder (delete all json files, but leave the empty folder): backend/backup
-
delete all "runtime data from db": http://localhost:8080/admin/tournament?admin=true
- DELETE ALL CALCULATIONS
- DELETE ALL POINTS
- DANGER DELETE TOURNAMENT QUEUE HISTORY
-
delete state on tablets: http://localhost:8080/admin/tournament-queue?admin=true
- Zeige Reset Screen
- -> auf allen Tablets "RESET" drücken
after the tournament
- copy the RawData backup data -> follow: backup RawPoints
NOTE: there is no update mechanism for masterdata yet, therefore you have to delete the db first!!! then you can start with the import again
-
DROP the whole schema (all data will be deleted!!!!): execute this script with the db tool e.g. dbeaver: backend/src/lib/db/reset.db.test.sql
-
export the excel sheets to csv (example: https://docs.google.com/spreadsheets/d/1Ax-EIuKVjAHVa0QG8diFmNAYTSgnSU8DpqN1bcepXhg/edit?usp=sharing)
-
copy the csv files to the master-data folder: backend/src/lib/db-migrations/master-data/
-
update the reportDefinitions file: ./frontend/src/lib/reportDefinitions.ts
-
if the reportsDefinitions have changed, run:
cd backend npm run build cd ../frontend npm run build
-
generate the db schema/tables and data types:
cd backend npm run generate
NOTE: tournament updates should be possible before the event without having to DROP the whole DB Schema
-
export the excel sheets to csv (example: https://docs.google.com/spreadsheets/d/1Ax-EIuKVjAHVa0QG8diFmNAYTSgnSU8DpqN1bcepXhg/edit?usp=sharing)
-
copy the Tournament.csv files to the dummy-data folder: backend/src/lib/db-migrations/dummy-data/
-
to transform to json, run the script:
cd backend/src/lib/db-migrations/dummy-data ts-node csv-to-json.ts Tournament.csv Tournament.json
-
upload the Tournament:
Note: the application must be running!
```sh
# import Tournament.json data via postman test (-> POST body)
# POST http://192.168.77.21:8080/api/tournaments/plan
```
- upload other Tournament data e.g. for testing (repeat the previous step with other Tournament.json data)
- the RawPoints at runtime are additionally automatically stored in json files (one for each RawPoint) in order to have a backup, if something would happen to the db. with the master-data and the RawPoints, all the Results can be recalculated.
Folder: backend/backup
- zip the whole folder and rename it with the tournament name
- copy the zip to a save location: e.g. https://drive.google.com/drive/folders/18_wugSlgD5wqF2gDvbTvUJ38ssNYPc9d
Precondition: master-data and tournament must be loaded. if the db is fresh, follow:
- import master data
- import tournament data
run this script:
cd backend
npm run restore