# Generated by Django 2.2.10 on 2020-07-08 10:55

from django.db import migrations, models


def from_strings_to_number(apps, schema_editor):
    Feedback = apps.get_model('support', 'Feedback')
    matching = {
        'negative': '2',
        'neutral': '3',
        'positive': '4',
    }

    for feedback in Feedback.objects.all():
        if feedback.evaluation in matching.keys():
            feedback.evaluation = matching[feedback.evaluation]
            feedback.save()


class Migration(migrations.Migration):

    dependencies = [
        ('support', '0006_feedback'),
    ]

    operations = [
        migrations.RunPython(from_strings_to_number),
        migrations.AlterField(
            model_name='feedback',
            name='evaluation',
            field=models.SmallIntegerField(
                choices=[
                    (1, 'Very negative'),
                    (2, 'Negative'),
                    (3, 'Neutral'),
                    (4, 'Positive'),
                    (5, 'Very positive'),
                ]
            ),
        ),
    ]
