Ejemplo n.º 1
0
    def addPlanningPorResponsable(self):
        responsable = defaultdict(list)
        dias = 14
        for t in self.tareas:
            for cod, s, in t.subtareas.items():
                if s.fecha_hasta is not None and s.fecha_hasta <= datetime.datetime.today(
                ) + datetime.timedelta(days=dias):
                    ####
                    subt = "{} {} ({}-{}..{})\n".format(
                        t.codigo, t.descripcion.upper(), cod.value,
                        date_to_str(s.fecha_desde), date_to_str(s.fecha_hasta))
                    ####
                    responsable[s.responsable].append(subt)

        lista_ordenada = []
        for r in responsable:
            lista_ordenada = self.ordenarTareas(responsable[r], r)
            responsable[r] = lista_ordenada

        headers = ["Responsable", "Tareas"]
        list_by_responsable = [[r, "".join(t)] for r, t in responsable.items()]
        self.map_excel['Planning por responsable'] = pd.DataFrame(
            list_by_responsable, columns=headers)
Ejemplo n.º 2
0
 def __str__(self):
     return "Subtarea:[" + '#'.join([
         self.codigo,
         date_to_str(self.fecha_desde),
         date_to_str(self.fecha_hasta), self.responsable, self.incurrible
     ]) + "]"
Ejemplo n.º 3
0
 def __str__(self):
     return '>>' + str(self.codigo) + ' ' + self. descripcion + ' - ' + date_to_str(self.fecha_vencimiento) + \
            ' - ' + (self.responsables.get("RF","Nadie asignado") if self.responsables else "Nadie asignado") + \
            ''.join([ '\n\t'+ str(subtarea) for subtarea in self.subtareas.values()])
Ejemplo n.º 4
0
    def validate(self):
        try:
            ''' Si la peticion esta pendiente de IBD no realiza mas validaciones '''
            if self.estado == 'PENDIENTE - IBD':
                ####
                try:
                    yield Validacion("Tarea pendiente de Iberdrola",
                                     self.tareaGestion.estado)
                except AttributeError:
                    yield Validacion(
                        "Tarea pendiente iberdrola vacia o inexistente")
            ####
            else:
                ''' Gestion vs Planner '''
                if not self.tareaGestion:
                    yield Validacion(
                        "No tiene tarea en la excel de Gestión asociada")

                try:
                    '''Fecha de valoración previa'''
                    if self.tareaGestion and self.tareaGestion.fecha_valoracion != self.subtareas[
                            CodigoSubtarea.ENFOQUE].fecha_hasta:
                        yield Validacion(
                            "Fecha de valoración previa no coincide [GESTION][PLANNER]",
                            "[" +
                            date_to_str(self.tareaGestion.fecha_valoracion) +
                            "][" + date_to_str(self.subtareas[
                                CodigoSubtarea.ENFOQUE].fecha_hasta) + "]")
                except KeyError:
                    if self.estado == 'VALORACION - DEF':
                        yield Validacion(
                            "No existe subtarea 'Elaborar Enfoque'")

                try:
                    '''Fecha de funcional'''
                    if self.tareaGestion and self.tareaGestion.fecha_funcional != self.subtareas[
                            CodigoSubtarea.
                            DEF].fecha_hasta and self.tareaGestion.fecha_funcional:
                        yield Validacion(
                            "Fecha de DEF no coincide [GESTION][PLANNER]",
                            "[" +
                            date_to_str(self.tareaGestion.fecha_funcional) +
                            "][" + date_to_str(
                                self.subtareas[CodigoSubtarea.DEF].fecha_hasta)
                            + "]")
                except KeyError:
                    if self.estado == 'VALORACION - DEF':
                        yield Validacion("No existe subtarea 'DEF'")

                try:
                    '''Fecha de entrega'''
                    if self.tareaGestion and self.tareaGestion.fecha_entrega != self.subtareas[
                            CodigoSubtarea.
                            ENTREGA].fecha_hasta and self.tareaGestion.fecha_entrega:
                        yield Validacion(
                            "Fecha de entrega no coincide [GESTION][PLANNER]",
                            "[" +
                            date_to_str(self.tareaGestion.fecha_entrega) +
                            "][" + date_to_str(self.subtareas[
                                CodigoSubtarea.ENTREGA].fecha_hasta) + "]")
                ###
                except ValueError:
                    yield Validacion(" El campo fecha esta vacio")
                ###
                except KeyError:
                    yield Validacion("No existe subtarea 'Entregar a IBD'")
                '''Validaciones generales en planner'''
                if not self.fecha_vencimiento:
                    yield Validacion("Sin fecha de vencimiento")
                if not self.responsables or "RF" not in self.responsables.keys(
                ) or not self.responsables["RF"]:
                    yield Validacion("No tiene asignado responsable funcional")
                '''Validaciones por estado en planner'''
                if self.estado == 'VALORACION - DEF':
                    try:
                        if self.fecha_vencimiento and (
                                self.fecha_vencimiento > self.subtareas[
                                    CodigoSubtarea.ENFOQUE].fecha_hasta
                                and self.fecha_vencimiento > self.subtareas[
                                    CodigoSubtarea.DEF].fecha_hasta):
                            yield Validacion(
                                "Fecha de vencimiento de la tarea es mayor que la fecha planificada [Vencimiento][Enfoque-DEF]",
                                "[" + date_to_str(self.fecha_vencimiento) +
                                "][" + date_to_str(self.subtareas[
                                    CodigoSubtarea.ENFOQUE].fecha_hasta) +
                                "-" + date_to_str(self.subtareas[
                                    CodigoSubtarea.DEF].fecha_hasta) + "]")
                    except TypeError:
                        '''Las fechas no permiten hacer la validacion'''
                        yield Validacion(
                            "No tiene planificadas fechas de Enfoque y/o DEF ",
                            "-".join([
                                date_to_str(self.subtareas[
                                    CodigoSubtarea.ENFOQUE].fecha_hasta),
                                date_to_str(self.subtareas[
                                    CodigoSubtarea.DEF].fecha_hasta)
                            ]))

                if self.estado == 'DESARROLLO- EFF':
                    try:
                        if self.fecha_vencimiento and self.fecha_vencimiento > self.subtareas[
                                CodigoSubtarea.EFF].fecha_hasta:
                            yield Validacion(
                                "Fecha de vencimiento de la tarea es mayor que la fecha planificada [Vencimiento][EFF]",
                                "[" + date_to_str(self.fecha_vencimiento) +
                                "][" + date_to_str(self.subtareas[
                                    CodigoSubtarea.EFF].fecha_hasta) + "]")
                    except TypeError:
                        yield Validacion("No tiene planificada fecha de EFF")
                    except KeyError:
                        yield Validacion("Error validando peticion")

                    if not self.responsables['RT']:
                        yield Validacion(
                            "La tarea no tiene asignado responsable técnico [RT]"
                        )

                if self.estado == 'DESARROLLO - DTE':
                    try:
                        if self.fecha_vencimiento and self.fecha_vencimiento > self.subtareas[
                                CodigoSubtarea.DTE].fecha_hasta:
                            yield Validacion(
                                "Fecha de vencimiento de la tarea es mayor que la fecha planificada [Vencimiento][DTE]",
                                "[" + date_to_str(self.fecha_vencimiento) +
                                "][" + date_to_str(self.subtareas[
                                    CodigoSubtarea.DTE].fecha_hasta) + "]")
                    ###
                    except KeyError:
                        yield Validacion(
                            " No existe tarea para el codigo subtarea " +
                            str(CodigoSubtarea))
                    ###
                    except TypeError:
                        yield Validacion(
                            "No tiene planificada fecha de DTE + PPU + RPI")

                    if not self.responsables['RD']:
                        yield Validacion(
                            "La tarea no tiene asignado responsable de desarrollo [RD]"
                        )

                if self.estado == 'ACN - INTEGRACION':
                    try:
                        if self.fecha_vencimiento and (
                                self.fecha_vencimiento >
                                self.subtareas[CodigoSubtarea.QA].fecha_hasta
                                and self.fecha_vencimiento > self.subtareas[
                                    CodigoSubtarea.ENTREGA].fecha_hasta):
                            yield Validacion(
                                "Fecha de vencimiento de la tarea es mayor que la fecha planificada [Vencimiento][Q&A-Entrega IBD]",
                                "[" + date_to_str(self.fecha_vencimiento) +
                                "][" + date_to_str(self.subtareas[
                                    CodigoSubtarea.QA].fecha_hasta) + "/" +
                                date_to_str(self.subtareas[
                                    CodigoSubtarea.ENTREGA].fecha_hasta) + "]")
                    except TypeError:
                        yield Validacion("No tiene planificada fecha de Q&A")
                    except KeyError:
                        yield Validacion("No tiene planificada fecha de Q&A")

                    if not self.responsables['QA']:
                        yield Validacion(
                            "La tarea no tiene asignado responsable de Q&A [QA]"
                        )

                if self.estado != 'VALORACION - DEF':
                    if CodigoSubtarea.ENTREGA not in self.subtareas or not self.subtareas[
                            CodigoSubtarea.ENTREGA].fecha_hasta:
                        #####
                        try:
                            yield Validacion(
                                "Sin fecha de entrega planificada [GESTION]",
                                date_to_str(self.tareaGestion.fecha_entrega)
                                if self.tareaGestion else "")
                        except ValueError:
                            yield Validacion(
                                " Campo fecha entrega planificada esta vacio")
                    #####
        except:
            logging.error('Error validando petición [{}]'.format(self.codigo))
            logging.error(traceback.format_exc())
Ejemplo n.º 5
0
 def to_list(cls,t, subtarea):
     return [t.area, str(t.codigo), t.descripcion, t.estado, date_to_str(t.fecha_vencimiento), \
             (t.responsables.get("RF","Nadie asignado") if t.responsables else "Nadie asignado"), t.tareaIncurridos.balance if t.tareaIncurridos else 'NA'] + SubtareaView.to_list(subtarea)
Ejemplo n.º 6
0
 def to_str(cls,t,subtarea):
     return '#'.join([ t.area, str(t.codigo), t.descripcion, t.estado, date_to_str(t.fecha_vencimiento), \
               (t.responsables.get("RF","Nadie asignado") if t.responsables else "Nadie asignado"), \
               t.tareaIncurridos.balance, \
               SubtareaView.show(subtarea)])+'\n'
Ejemplo n.º 7
0
 def to_list(cls, s):
     return [s.codigo.value,date_to_str(s.fecha_desde), date_to_str(s.fecha_hasta), s.responsable, str(s.incurrible)]
Ejemplo n.º 8
0
 def show(self, s):
     return '#'.join([s.codigo.value,date_to_str(s.fecha_desde), date_to_str(s.fecha_hasta), s.responsable, str(s.incurrible)])