<commit_before># -*- coding: utf-8 -*-
from django.core import serializers
from django.core.files.temp import NamedTemporaryFile
from django.core.mail import send_mail
from django.core.management import call_command
from django_apogee.models import InsAdmEtp, Individu, Adresse, AnneeUni, ConfAnneeUni, EtpGererCge, InsAdmEtpInitial

__author__ = 'paul'
from django.core.management.base import BaseCommand
from optparse import make_option
from foad.models import Remontee


class Command(BaseCommand):

    option_list = BaseCommand.option_list + (
        make_option('--annee',
                    action='store',
                    type="int",
                    dest='annee',
                    default=None,
                    help='annee de remontee'),
    )

    def handle(self, *args, **options):
        etps = list(EtpGererCge.objects.filter(cod_cmp='034').values_list('cod_etp', flat=True))
        annees = list(ConfAnneeUni.objects.filter(synchro=True).values_list('cod_anu', flat=True))
        try:
            # on récupére les personnes du jour (soit la date de création, de modif plus grand que la veille
            # Remontee.objects.filter(is_valide=True).update(is_valide=False)

            # self.copy_oracle_base(Individu.objects.using('oracle').filter(etapes__cod_etp__in=etps,
            #                                                               etapes__cod_anu__in=annees).distinct(), ['default'])
            # self.copy_oracle_base(Individu.objects.using('oracle').filter(
            #     etapes__cod_etp__in=etps,
            #     etapes__cod_anu__in=annees).distinct(), ['default'])
            # ADRESSE annuelle
            # self.copy_oracle_base(Adresse.objects.using('oracle').filter(
            #     cod_ind_ina__etapes__cod_etp__in=etps,
            #     cod_ind_ina__etapes__cod_anu__in=annees,
            #     cod_anu_ina__in=annees).exclude(cod_ind_ina__lib_pr1_ind='DOUBLONS'), ['default'])
            # #ADRESSE fixe
            # self.copy_oracle_base(Adresse.objects.using('oracle').filter(cod_ind__etapes__cod_etp__in=etps,
            #                                                              cod_ind__etapes__cod_anu__in=annees)
            #                                                      .exclude(cod_ind__lib_pr1_ind='DOUBLONS'), ['default'])
            #
            for x in InsAdmEtpInitial.objects.using("oracle").filter(cod_etp__in=etps, cod_anu__in=annees):
                c = x.copy()

                # x.copy(using='duck_bo_etu')
                # if not hasattr(c, 'remontee'):
                #     Remontee.objects.using('default').create(etape=c, is_valide=True)<commit_msg>ajout moodle en modele<commit_after># -*- coding: utf-8 -*-
from django.core import serializers
from django.core.files.temp import NamedTemporaryFile
from django.core.mail import send_mail
from django.core.management import call_command
from django_apogee.models import InsAdmEtp, Individu, Adresse, AnneeUni, ConfAnneeUni, EtpGererCge, InsAdmEtpInitial

__author__ = 'paul'
from django.core.management.base import BaseCommand
from optparse import make_option
from foad.models import Remontee


class Command(BaseCommand):

    option_list = BaseCommand.option_list + (
        make_option('--annee',
                    action='store',
                    type="int",
                    dest='annee',
                    default=None,
                    help='annee de remontee'),
    )

    def handle(self, *args, **options):
        etps = list(EtpGererCge.objects.filter(cod_cmp='034').values_list('cod_etp', flat=True))
        annees = list(ConfAnneeUni.objects.filter(synchro=True).values_list('cod_anu', flat=True))
        try:
            # on récupére les personnes du jour (soit la date de création, de modif plus grand que la veille
            # Remontee.objects.filter(is_valide=True).update(is_valide=False)

            self.copy_oracle_base(Individu.objects.using('oracle').filter(etapes__cod_etp__in=etps,
                                                                          etapes__cod_anu__in=annees).distinct(), ['default'])
            # self.copy_oracle_base(Individu.objects.using('oracle').filter(
            #     etapes__cod_etp__in=etps,
            #     etapes__cod_anu__in=annees).distinct(), ['default'])
            # ADRESSE annuelle
            # self.copy_oracle_base(Adresse.objects.using('oracle').filter(
            #     cod_ind_ina__etapes__cod_etp__in=etps,
            #     cod_ind_ina__etapes__cod_anu__in=annees,
            #     cod_anu_ina__in=annees).exclude(cod_ind_ina__lib_pr1_ind='DOUBLONS'), ['default'])
            # #ADRESSE fixe
            # self.copy_oracle_base(Adresse.objects.using('oracle').filter(cod_ind__etapes__cod_etp__in=etps,
            #                                                              cod_ind__etapes__cod_anu__in=annees)
            #                                                      .exclude(cod_ind__lib_pr1_ind='DOUBLONS'), ['default'])
            #
            for x in InsAdmEtpInitial.objects.using("oracle").filter(cod_etp__in=etps, cod_anu__in=annees):
                c = x.copy()

                # x.copy(using='duck_bo_etu')
                # if not hasattr(c, 'remontee'):
                #     Remontee.objects.using('default').create(etape=c, is_valide=True)
{'fraction_non_alphanumeric': 0.10465333582507942, 'fraction_numerical': 0.0022425714819659876, 'mean_word_length': 2.1933174224343674, '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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4327143', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1604, 'n_words': 240}