feat: implemented algorythm and indexed more fields

This commit is contained in:
ITQ
2025-02-21 07:12:46 +03:00
parent e85df62859
commit 42aee455ba
2 changed files with 113 additions and 27 deletions
@@ -1,4 +1,4 @@
# Generated by Django 5.1.6 on 2025-02-17 18:16
# Generated by Django 5.1.6 on 2025-02-21 03:50
import apps.campaign.models
import django.core.validators
@@ -28,12 +28,12 @@ class Migration(migrations.Migration):
('ad_title', models.TextField()),
('ad_text', models.TextField()),
('ad_image', models.ImageField(blank=True, max_length=256, null=True, upload_to=apps.campaign.models.Campaign.ad_image_directory_path)),
('start_date', models.PositiveIntegerField()),
('end_date', models.PositiveIntegerField()),
('gender', models.CharField(blank=True, choices=[('MALE', 'MALE'), ('FEMALE', 'FEMALE'), ('ALL', 'ALL')], max_length=6, null=True)),
('age_from', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)])),
('age_to', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)])),
('location', models.TextField(blank=True, null=True, validators=[django.core.validators.MinLengthValidator(1)])),
('start_date', models.PositiveIntegerField(db_index=True)),
('end_date', models.PositiveIntegerField(db_index=True)),
('gender', models.CharField(blank=True, choices=[('MALE', 'MALE'), ('FEMALE', 'FEMALE'), ('ALL', 'ALL')], db_index=True, max_length=6, null=True)),
('age_from', models.PositiveSmallIntegerField(blank=True, db_index=True, null=True, validators=[django.core.validators.MaxValueValidator(100)])),
('age_to', models.PositiveSmallIntegerField(blank=True, db_index=True, null=True, validators=[django.core.validators.MaxValueValidator(100)])),
('location', models.TextField(blank=True, db_index=True, null=True, validators=[django.core.validators.MinLengthValidator(1)])),
('advertiser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='campaigns', to='advertiser.advertiser')),
],
options={
@@ -45,7 +45,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('price', models.FloatField()),
('date', models.PositiveIntegerField()),
('date', models.PositiveIntegerField(db_index=True)),
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clicks', to='campaign.campaign')),
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clicks', to='client.client')),
],
@@ -58,7 +58,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('price', models.FloatField()),
('date', models.PositiveIntegerField()),
('date', models.PositiveIntegerField(db_index=True)),
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='impressions', to='campaign.campaign')),
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='impressions', to='client.client')),
],