diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 638e3ef..9d309b8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,6 +21,8 @@ jobs: with: python-version: "3.10" cache: "pip" + - name: Install GDAL + run: sudo apt-get update && sudo apt install postgresql-14 postgresql-14-postgis-3 postgresql-server-dev-14 python3-psycopg binutils libproj-dev gdal-bin - name: Install python dependencies run: pip install -r back/requirements.txt - name: Install front js dependencies diff --git a/back/plantability/management/commands/c01_compute_plantability_indice.py b/back/plantability/management/commands/c01_compute_plantability_indice.py index a453020..9b67efe 100644 --- a/back/plantability/management/commands/c01_compute_plantability_indice.py +++ b/back/plantability/management/commands/c01_compute_plantability_indice.py @@ -13,6 +13,7 @@ load_geodataframe_from_db, select_city, ) +from tqdm import tqdm def compute_indice(tiles_id) -> None: @@ -62,19 +63,23 @@ def compute_normalized_indice() -> None: ] # Fetch in batches to avoid OOM issues - batch_size = 1e5 + batch_size = int(1e5) offset = 0 qs = Tile.objects.all() - while True: - print(f"Batch: {offset+1}") - tiles_batch = qs[offset : offset + batch_size] - if not tiles_batch: - break - Tile.objects.filter(id__in=[tile.id for tile in tiles_batch]).update( - plantability_normalized_indice=(F("plantability_indice") - min_indice) - / (max_indice - min_indice) - ) - offset += 1 + total_batches = (len(qs) + batch_size - 1) // batch_size + with tqdm(total=total_batches, desc="Processing Batches") as pbar: + while True: + tiles_batch = qs[offset : offset + batch_size] + if not tiles_batch: + break + Tile.objects.filter(id__in=[tile.id for tile in tiles_batch]).update( + plantability_normalized_indice=( + F("plantability_indice") - min_indice + ) + / (max_indice - min_indice) + ) + offset += 1 + pbar.update(1) class Command(BaseCommand): diff --git a/front/tests/empty.test.ts b/front/tests/empty.test.ts new file mode 100644 index 0000000..616ddba --- /dev/null +++ b/front/tests/empty.test.ts @@ -0,0 +1,5 @@ +import { test, expect } from 'vitest'; + +test('empty test', () => { + expect(true).toBe(true); +});