Skip to content

Commit

Permalink
Merge 25bb3a3 into 9cc3ced
Browse files Browse the repository at this point in the history
  • Loading branch information
dyohan9 committed Oct 21, 2019
2 parents 9cc3ced + 25bb3a3 commit d85ab09
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
31 changes: 31 additions & 0 deletions bothub/common/migrations/0032_repository_total_updates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 2.1.5 on 2019-08-14 19:45

from django.db import migrations, models

from bothub.common.models import RepositoryUpdate
from bothub.common.models import Repository


def updateRepository(apps, schema_editor):
for update in RepositoryUpdate.objects.all().filter(
trained_at__isnull=False
):
repository = Repository.objects.get(uuid=update.repository.uuid)
repository.total_updates += 1
repository.save()


class Migration(migrations.Migration):

dependencies = [
('common', '0031_auto_20190502_1732'),
]

operations = [
migrations.AddField(
model_name='repository',
name='total_updates',
field=models.IntegerField(default=0, verbose_name='total updates'),
),
migrations.RunPython(updateRepository),
]
16 changes: 1 addition & 15 deletions bothub/common/migrations/0037_auto_20191011_2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
from django.conf import settings
from bothub.utils import send_bot_data_file_aws
from bothub.common.models import RepositoryUpdate
from bothub.common.models import Repository


def updateRepository(apps, schema_editor):
for update in RepositoryUpdate.objects.all().filter(trained_at__isnull=False):
repository = Repository.objects.get(uuid=update.repository.uuid)
repository.total_updates += 1
repository.save()


def update_repository(apps, schema_editor):
Expand All @@ -27,7 +19,7 @@ def update_repository(apps, schema_editor):

class Migration(migrations.Migration):

dependencies = [("common", "0031_auto_20190502_1732")]
dependencies = [("common", "0032_repository_total_updates")]

operations = [
migrations.RemoveField(model_name="repositoryvote", name="vote"),
Expand All @@ -36,12 +28,6 @@ class Migration(migrations.Migration):
name="nlp_server",
field=models.URLField(blank=True, null=True, verbose_name="Base URL NLP"),
),
migrations.AddField(
model_name="repository",
name="total_updates",
field=models.IntegerField(default=0, verbose_name="total updates"),
),
migrations.RunPython(updateRepository),
migrations.AddField(
model_name="repositoryvote",
name="created",
Expand Down

0 comments on commit d85ab09

Please sign in to comment.