From 5f0c555aa3699a145fddfcdf651851ee92ad63ef Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 11 Mar 2023 17:28:08 +0000 Subject: [PATCH] Make cheat interval dropdown --- ...16_alter_platform_cheat_interval_seconds.py | 18 ++++++++++++++++++ core/models.py | 11 ++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 core/migrations/0016_alter_platform_cheat_interval_seconds.py diff --git a/core/migrations/0016_alter_platform_cheat_interval_seconds.py b/core/migrations/0016_alter_platform_cheat_interval_seconds.py new file mode 100644 index 0000000..6b5adb5 --- /dev/null +++ b/core/migrations/0016_alter_platform_cheat_interval_seconds.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.7 on 2023-03-11 17:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0015_platform_base_usd_platform_withdrawal_trigger'), + ] + + operations = [ + migrations.AlterField( + model_name='platform', + name='cheat_interval_seconds', + field=models.IntegerField(choices=[(60, 'Every minute'), (300, 'Every 5 minutes'), (600, 'Every 10 minutes'), (3600, 'Every hour'), (14400, 'Every 4 hours'), (86400, 'Every day')], default=3600), + ), + ] diff --git a/core/models.py b/core/models.py index d59cb1d..caf3e97 100644 --- a/core/models.py +++ b/core/models.py @@ -12,6 +12,15 @@ SERVICE_CHOICES = (("nordigen", "Nordigen"),) PLATFORM_SERVICE_CHOICES = (("agora", "Agora"),) +INTERVAL_CHOICES = ( + (60, "Every minute"), + (60 * 5, "Every 5 minutes"), + (60 * 10, "Every 10 minutes"), + (60 * 60, "Every hour"), + (60 * 60 * 4, "Every 4 hours"), + (86400, "Every day"), +) + class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) @@ -109,7 +118,7 @@ class Platform(models.Model): send = models.BooleanField(default=True) cheat = models.BooleanField(default=False) dummy = models.BooleanField(default=False) - cheat_interval_seconds = models.IntegerField(default=600) + cheat_interval_seconds = models.IntegerField(default=3600, choices=INTERVAL_CHOICES) margin = models.FloatField(default=1.20) max_margin = models.FloatField(default=1.30)