Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/datawookie/paddle

Race management software for the Waterside Kayak Series
https://github.com/datawookie/paddle

Last synced: 1 day ago
JSON representation

Race management software for the Waterside Kayak Series

Awesome Lists containing this project

README

        

# paddle

A web application developed for the [Newbury Canoe Club](https://www.newburycanoeclub.co.uk/) to manage entries and results for the [Waterside Series](https://www.newburycanoeclub.co.uk/waterside) of kayak races.

The loading splash screen.

List of series and races.

Entries for a specific race.

## Setup

1. Install SQLite3.
2. `apt-get install -y libpangocairo-1.0-0`.
3. Create a virtual environment and install Python packages.

## App

Running the app:

```
flask --app paddle run
```

During development you will want to run the app in debug mode:

```
flask --app paddle --debug run
```

The app will be available on http://127.0.0.1:5000.

When running on EC2 use:

```
flask --app paddle run --host 0.0.0.0
# With debug (but this is not a great idea!)
flask --app paddle --debug run --host 0.0.0.0
```

## Users

Followed these articles to setup user management:

- https://www.freecodecamp.org/news/how-to-authenticate-users-in-flask/
- https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-v-user-logins

## Database

### Alembic

Using Alembic to create migration scripts.

At present the Alembic migrations are applied to a `paddle.db` file in the `database/` folder. So you'll need to move the file to that location first.

Commands used:

- `alembic revision -m "..."` — An empty migration (message is optional).
- `alembic revision --autogenerate -m "..."` — Autogenerated from changes to classes (message is optional).
- `alembic upgrade head` — Apply the most recent migrations.
- `alembic current`
- `alembic history`

Before trying to generate migrations you need to make sure that any new classes have already been imported into the database package.

Alembic produces migrations in Python. We can convert those to SQL.

The old and new hash are obtained from the `current` and `history` operations.

```bash
OUTPATH=liquibase/changesets/${NEWHASH}
mkdir -p ${OUTPATH}
alembic upgrade ${OLDHASH}:${NEWHASH} --sql >${OUTPATH}/setup.sql
```

### Liquibase

Liquibase used to manage deployment (via CI/CD) of migration scripts.

To prepare the SQL script for Liquibase, annotate it according to the following rules:

1. Begin every script with a `--liquibase formatted sql` line.
2. Stamp the changeset with a `--changeset YOURNAMEHERE:NEWHASH` slug.
3. Use a `--precondition-sql-check` to check the current version.
4. Comment liberally via `--comment: ...`.
5. Whenever possible, follow each statement with a `--rollback: `.

Each changeset needs to be added to the master XML file `db.changelog-root.xml`.

Further documentation can be found [here](https://docs.liquibase.com/concepts/basic/sql-format.html).

## Testing

To run test suite:

```bash
# Run all tests.
pytest
# Run all tests and show console output (useful for debugging).
pytest -s
```

Tests are run by CI/CD. Coverage report can be found at https://datawookie.gitlab.io/paddle/.

### Coverage

To get a coverage report:

```bash
pytest --cov-report html:public --cov
```

The report will be written to `public/`.

## Number Ranges

- Category 1: 1 - (K2 senior)
- Category 2: 45 - (K2 junior)
- Category 3: 100 - (K2 ladies)
- Category 4: 135 - (K2 junior ladies)
- Category 5: 170 - (K2 veteran)
- Category 6: 230 - (K2 mixed)
- Category 7: 280 - (K2 junior/veteran)
- Category 8: 300 - (K1 senior)
- Category 9: 330 - (K1 junior)
- Category 10: 350 - (K1 ladies)
- Category 11: 390 - (K1 veteran)
- Category 12: 450 - (C2)
- Category 13: 485 - (C1)