<commit_before># coding=utf-8
from __future__ import unicode_literals

from datetime import datetime, timedelta
import os
from subprocess import call
from django.db import models
from django.conf import settings
from abonapp.models import Abon

from devapp.models import Device
from djing.settings import BASE_DIR


TASK_PRIORITIES = (
    (b'A', u'Высший'),
    (b'B', u'Выше среднего'),
    (b'C', u'Средний'),
    (b'D', u'Ниже среднего'),
    (b'E', u'Низкий')
)

TASK_STATES = (
    (b'S', u'Новая'),
    (b'C', u'На выполнении'),
    (b'F', u'Выполнена')
)

TASK_TYPES = (
    (b'na', u'не выбрано'),
    (b'yt', u'жёлтый треугольник'),
    (b'rc', u'красный крестик'),
    (b'ls', u'слабая скорость'),
    (b'cf', u'обрыв кабеля'),
    (b'cn', u'подключение'),
    (b'pf', u'переодическое пропадание'),
    (b'cr', u'настройка роутера'),
    (b'ot', u'другое')
)


class Task(models.Model):
    descr = models.CharField(max_length=128)
    recipient = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
    author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
    device = models.ForeignKey(Device, related_name='dev')
    priority = models.CharField(max_length=1, choices=TASK_PRIORITIES, default=TASK_PRIORITIES[2][0])
    out_date = models.DateField(null=True, blank=True, default=datetime.now() + timedelta(days=7))
    time_of_create = models.DateTimeField(auto_now_add=True)
    state = models.CharField(max_length=1, choices=TASK_STATES, default=TASK_STATES[0][0])
    attachment = models.ImageField(upload_to='task_attachments/%Y.%m.%d', blank=True, null=True)
    mode = models.CharField(max_length=2, choices=TASK_TYPES, default=TASK_TYPES[0][0])
    abon = models.ForeignKey(Abon, on_delete=models.SET_NULL, null=True, blank=True)

    def __unicode__(self):
        return self.descr

    class Meta:
        db_table = 'task'
        ordering = ('-id',)

    def finish(self, current_user):
        self.state = 'F'  # Выполнена
        self.out_date = datetime.now()  # Время завершения

    def begin(self, current_user):
        self.state = 'C'  # Начата
<commit_msg>подправил приоритет и виды задач<commit_after># coding=utf-8
from __future__ import unicode_literals

from datetime import datetime, timedelta
import os
from subprocess import call
from django.db import models
from django.conf import settings
from abonapp.models import Abon

from devapp.models import Device
from djing.settings import BASE_DIR


TASK_PRIORITIES = (
    (b'A', u'Высший'),
    (b'C', u'Средний'),
    (b'E', u'Низкий')
)

TASK_STATES = (
    (b'S', u'Новая'),
    (b'C', u'На выполнении'),
    (b'F', u'Выполнена')
)

TASK_TYPES = (
    (b'na', u'не выбрано'),
    (b'yt', u'жёлтый треугольник'),
    (b'rc', u'красный крестик'),
    (b'ls', u'слабая скорость'),
    (b'cf', u'обрыв кабеля'),
    (b'cn', u'подключение'),
    (b'pf', u'переодическое пропадание'),
    (b'cr', u'настройка роутера'),
    (b'co', u'настроить onu'),
    (b'fc', u'обжать кабель'),
    (b'ot', u'другое')
)


class Task(models.Model):
    descr = models.CharField(max_length=128)
    recipient = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
    author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
    device = models.ForeignKey(Device, related_name='dev')
    priority = models.CharField(max_length=1, choices=TASK_PRIORITIES, default=TASK_PRIORITIES[2][0])
    out_date = models.DateField(null=True, blank=True, default=datetime.now() + timedelta(days=7))
    time_of_create = models.DateTimeField(auto_now_add=True)
    state = models.CharField(max_length=1, choices=TASK_STATES, default=TASK_STATES[0][0])
    attachment = models.ImageField(upload_to='task_attachments/%Y.%m.%d', blank=True, null=True)
    mode = models.CharField(max_length=2, choices=TASK_TYPES, default=TASK_TYPES[0][0])
    abon = models.ForeignKey(Abon, on_delete=models.SET_NULL, null=True, blank=True)

    def __unicode__(self):
        return self.descr

    class Meta:
        db_table = 'task'
        ordering = ('-id',)

    def finish(self, current_user):
        self.state = 'F'  # Выполнена
        self.out_date = datetime.now()  # Время завершения

    def begin(self, current_user):
        self.state = 'C'  # Начата

{'fraction_non_alphanumeric': 0.14926073691621686, 'fraction_numerical': 0.006571227411405773, 'mean_word_length': 4.26823238566131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3780695', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1692, 'n_words': 306}