Separate bounce migration into two
This commit is contained in:
parent
fe8e766670
commit
8bab14cc8a
@ -1,15 +1,6 @@
|
|||||||
# Generated by Django 3.1.7 on 2021-03-28 21:38
|
# Generated by Django 3.1.7 on 2021-03-28 21:38
|
||||||
|
|
||||||
from django.db.models.expressions import F
|
|
||||||
from ..models import Session, Hit
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.db.models import Subquery, OuterRef
|
|
||||||
|
|
||||||
|
|
||||||
def update_bounce_stats(_a, _b):
|
|
||||||
Session.objects.all().annotate(hit_count=models.Count("hit")).filter(
|
|
||||||
hit_count__gt=1
|
|
||||||
).update(is_bounce=False)
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -23,6 +14,5 @@ class Migration(migrations.Migration):
|
|||||||
model_name="session",
|
model_name="session",
|
||||||
name="is_bounce",
|
name="is_bounce",
|
||||||
field=models.BooleanField(db_index=True, default=True),
|
field=models.BooleanField(db_index=True, default=True),
|
||||||
),
|
)
|
||||||
migrations.RunPython(update_bounce_stats, lambda: ()),
|
|
||||||
]
|
]
|
||||||
|
21
shynet/analytics/migrations/0009_auto_20210329_1100.py
Normal file
21
shynet/analytics/migrations/0009_auto_20210329_1100.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 3.1.7 on 2021-03-29 15:00
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
from ..models import Session
|
||||||
|
|
||||||
|
|
||||||
|
def update_bounce_stats(_a, _b):
|
||||||
|
Session.objects.all().annotate(hit_count=models.Count("hit")).filter(
|
||||||
|
hit_count__gt=1
|
||||||
|
).update(is_bounce=False)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("analytics", "0008_session_is_bounce"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(update_bounce_stats, lambda: ()),
|
||||||
|
]
|
@ -18,7 +18,7 @@ import urllib.parse as urlparse
|
|||||||
from django.contrib.messages import constants as messages
|
from django.contrib.messages import constants as messages
|
||||||
|
|
||||||
# Increment on new releases
|
# Increment on new releases
|
||||||
VERSION = "v0.8.1"
|
VERSION = "v0.8.2alpha"
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
Loading…
Reference in New Issue
Block a user