From 7448c361bf1ddce652ec935dd86c965b65cdf613 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 18 Apr 2023 08:31:36 +0100 Subject: [PATCH] Implement setting minimum feedback score --- core/clients/platform.py | 2 +- core/forms.py | 2 ++ .../0035_ad_require_feedback_score.py | 18 ++++++++++++++++++ core/models.py | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 core/migrations/0035_ad_require_feedback_score.py diff --git a/core/clients/platform.py b/core/clients/platform.py index 81de66f..e226340 100644 --- a/core/clients/platform.py +++ b/core/clients/platform.py @@ -570,7 +570,7 @@ class LocalPlatformClient(ABC): "track_max_amount": False, "require_trusted_by_advertiser": False, "online_provider": provider, - "require_feedback_score": 0, + "require_feedback_score": ad.require_feedback_score, } form["asset"] = asset form["payment_method_details"] = ad.payment_method_details diff --git a/core/forms.py b/core/forms.py index 050f516..d2f2d0c 100644 --- a/core/forms.py +++ b/core/forms.py @@ -177,6 +177,7 @@ class AdForm(RestrictedFormMixin, ModelForm): "provider_list", # "platforms", # "aggregators", + "require_feedback_score", "account_whitelist", "send_reference", "visible", @@ -194,6 +195,7 @@ class AdForm(RestrictedFormMixin, ModelForm): "provider_list": "List of providers to distribute ads for.", # "platforms": "Enabled platforms for this ad", # "aggregators": "Enabled aggregators for this ad", + "require_feedback_score": "Mminimum feedback score for users. Set to 0 to disable.", "account_whitelist": "List of account IDs to use, one per line.", "send_reference": "Whether or not to send the reference on new trades.", "visible": "Whether or not this ad is visible.", diff --git a/core/migrations/0035_ad_require_feedback_score.py b/core/migrations/0035_ad_require_feedback_score.py new file mode 100644 index 0000000..e862a85 --- /dev/null +++ b/core/migrations/0035_ad_require_feedback_score.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.7 on 2023-04-18 07:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0034_transaction_requisition'), + ] + + operations = [ + migrations.AddField( + model_name='ad', + name='require_feedback_score', + field=models.IntegerField(default=0), + ), + ] diff --git a/core/models.py b/core/models.py index 621be99..4db155a 100644 --- a/core/models.py +++ b/core/models.py @@ -509,6 +509,8 @@ class Ad(models.Model): payment_method_details = models.CharField(max_length=255) + require_feedback_score = models.IntegerField(default=0) + dist_list = models.TextField() asset_list = models.ManyToManyField(Asset)