refactor: reformatted code
This commit is contained in:
@@ -173,9 +173,7 @@ def upload_ad_image(
|
||||
advertiser_id=advertiser_id,
|
||||
)
|
||||
if ad_image.size >= 10 * 1024 * 1024:
|
||||
raise HttpError(
|
||||
status.BAD_REQUEST, "File can't be bigger than 10MB."
|
||||
)
|
||||
raise HttpError(status.BAD_REQUEST, "File can't be bigger than 10MB.")
|
||||
try:
|
||||
Image.open(ad_image).verify()
|
||||
except (OSError, SyntaxError):
|
||||
|
||||
@@ -20,8 +20,8 @@ from apps.campaign.validators import (
|
||||
CampaignLimitsValidator,
|
||||
CampaignReportMessageValidator,
|
||||
CampaignStartDateValidator,
|
||||
CampaignTargetingGenderValidator,
|
||||
CampaignTargetingLocationValidator,
|
||||
CampaignTargetingGenderValidator
|
||||
)
|
||||
from apps.client.models import Client
|
||||
from apps.core.models import BaseModel
|
||||
@@ -385,14 +385,16 @@ class Campaign(BaseModel):
|
||||
else 1
|
||||
)
|
||||
|
||||
prioritized.append((
|
||||
campaign,
|
||||
{
|
||||
"profit": profit,
|
||||
"ml": ml_score,
|
||||
"capacity": 1 - capacity_ratio,
|
||||
},
|
||||
))
|
||||
prioritized.append(
|
||||
(
|
||||
campaign,
|
||||
{
|
||||
"profit": profit,
|
||||
"ml": ml_score,
|
||||
"capacity": 1 - capacity_ratio,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
if not ml_values or not profit_values:
|
||||
return None
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models.fields import Field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from apps.campaign.models import Campaign, CampaignReport
|
||||
@@ -21,6 +20,7 @@ class CampaignTargetingGenderValidator:
|
||||
err = "gender can't be blank."
|
||||
raise ValidationError(err)
|
||||
|
||||
|
||||
class CampaignAgeValidator:
|
||||
def __call__(self, instance: "Campaign") -> None:
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user