From 85704a576556baba6c4ae10bd8a0bf10545f1070 Mon Sep 17 00:00:00 2001 From: Florian Knappers <73856313+JJFlorian@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:15:15 +0100 Subject: [PATCH] formatting --- api/bro_import/bulk_import.py | 2 +- api/migrations/0024_importtask_progress.py | 17 +++++++++++++++++ .../0025_alter_importtask_progress.py | 17 +++++++++++++++++ api/models.py | 1 + 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 api/migrations/0024_importtask_progress.py create mode 100644 api/migrations/0025_alter_importtask_progress.py diff --git a/api/bro_import/bulk_import.py b/api/bro_import/bulk_import.py index a15f546..1ec209e 100644 --- a/api/bro_import/bulk_import.py +++ b/api/bro_import/bulk_import.py @@ -44,7 +44,7 @@ def run(self) -> None: for bro_id in bro_ids: counter += 1 progress = (counter / total_bro_ids) * 100 - self.import_task_instance.log = f"Progress: {progress:.2f}%" + self.import_task_instance.progress = round(progress, 2) self.import_task_instance.save() try: diff --git a/api/migrations/0024_importtask_progress.py b/api/migrations/0024_importtask_progress.py new file mode 100644 index 0000000..bf24b17 --- /dev/null +++ b/api/migrations/0024_importtask_progress.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.1 on 2024-03-26 13:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("api", "0023_uploadtask_bro_id_alter_uploadtask_registration_type"), + ] + + operations = [ + migrations.AddField( + model_name="importtask", + name="progress", + field=models.CharField(blank=True, max_length=8, null=True), + ), + ] diff --git a/api/migrations/0025_alter_importtask_progress.py b/api/migrations/0025_alter_importtask_progress.py new file mode 100644 index 0000000..9aac1e6 --- /dev/null +++ b/api/migrations/0025_alter_importtask_progress.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.1 on 2024-03-26 13:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("api", "0024_importtask_progress"), + ] + + operations = [ + migrations.AlterField( + model_name="importtask", + name="progress", + field=models.FloatField(blank=True, null=True), + ), + ] diff --git a/api/models.py b/api/models.py index 9174aac..9b182c5 100644 --- a/api/models.py +++ b/api/models.py @@ -51,6 +51,7 @@ class ImportTask(models.Model): max_length=20, choices=choices.STATUS_CHOICES, default="PENDING", blank=True ) log = models.TextField(blank=True) + progress = models.FloatField(blank=True, null=True) def __str__(self): return f"{self.bro_domain} import - {self.data_owner}"