# Generated by Django 2.1.7 on 2019-04-28 09:53

from django.db import migrations

def trim_event_create_completion_reroute_checkoff(apps, schema_editor):

    Event = apps.get_model('internal', 'Event')
    EventCompletion = apps.get_model('internal', 'EventCompletion')
    EventCheckoff = apps.get_model('internal', 'EventCheckoff')

    for e in Event.objects.all():
        c = EventCompletion(event=e)
        c.repeatable = e.repeatable
        c.points = e.points
        c.save()
        for co in EventCheckoff.objects.filter(event=e):
            co.event_completion = c
            co.save()

class Migration(migrations.Migration):

    dependencies = [
        ('internal', '0016_auto_20190428_0943'),
    ]

    operations = [
      migrations.RunPython(trim_event_create_completion_reroute_checkoff),
    ]
