Skip to content

Commit

Permalink
fix: add unique constraint in task_logs for expense_group, add interv…
Browse files Browse the repository at this point in the history
…al for next run (#408)
  • Loading branch information
Hrishabh17 committed Nov 15, 2024
1 parent 390924a commit cd82ade
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions apps/tasks/migrations/0010_alter_tasklog_expense_group.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
1 change: 1 addition & 0 deletions apps/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/workspaces/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
)

Expand Down

0 comments on commit cd82ade

Please sign in to comment.