diff --git a/apps/tasks/migrations/0010_alter_tasklog_expense_group.py b/apps/tasks/migrations/0010_alter_tasklog_expense_group.py new file mode 100644 index 00000000..d6e78955 --- /dev/null +++ b/apps/tasks/migrations/0010_alter_tasklog_expense_group.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.14 on 2024-11-14 10:37 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('fyle', '0020_expensegroup_export_url'), + ('tasks', '0009_error_repetition_count'), + ] + + operations = [ + migrations.AlterField( + model_name='tasklog', + name='expense_group', + field=models.ForeignKey(help_text='Reference to Expense group', null=True, on_delete=django.db.models.deletion.PROTECT, to='fyle.expensegroup', unique=True), + ), + ] diff --git a/apps/tasks/models.py b/apps/tasks/models.py index 04732c5a..a744d474 100644 --- a/apps/tasks/models.py +++ b/apps/tasks/models.py @@ -32,6 +32,7 @@ class TaskLog(models.Model): on_delete=models.PROTECT, null=True, help_text="Reference to Expense group", + unique=True ) payment = models.ForeignKey( Payment, on_delete=models.PROTECT, help_text="Reference to Payment", null=True diff --git a/apps/workspaces/queue.py b/apps/workspaces/queue.py index d8716e90..3908c3d3 100644 --- a/apps/workspaces/queue.py +++ b/apps/workspaces/queue.py @@ -57,7 +57,7 @@ def schedule_sync( defaults={ "schedule_type": Schedule.MINUTES, "minutes": hours * 60, - "next_run": datetime.now(), + "next_run": datetime.now() + timedelta(hours=hours), } )