def add_hours(person, hours, cod, day, month, hour_date, year):
    limit = cl.limit_hour(hour_date)
    #sale del metodo cuando no haya horas para sumar
    if (hours <= 0):
        return 0
    if aux_m.is_diurnal(hour_date):
        if cl.is_holiday(day, month, year):
            print(limit, hour_date)
            if (hours <= limit):
                person.add_H_Fdiunrs(hours, cod)
                return 0
            person.add_H_Fdiunrs(limit, cod)
        else:
            if (hours <= limit):
                person.add_H_diunrs(hours, cod)
                return 0
            person.add_H_diunrs(limit, cod)
        return add_hours(person, cl.add_hour(hours, limit, 1), cod, day, month,
                         "21:00", year)
    else:
        hour_new = "06:00"
        if cl.is_holiday(day, month, year):
            if hours <= limit:
                person.add_H_Fnocturns(hours, cod)
                return 0
            person.add_H_Fnocturns(limit, cod)
        else:
            if hours < limit:
                person.add_H_nocturns(hours, cod)
                return 0
            person.add_H_nocturns(limit, cod)

        if cl.is_change_day(hour_date):
            if cl.is_end_month(day, month, year):
                day = "01"
                month = cl.add_month(month)
            else:
                day = cl.add_day(day)
            hour_new = "00:00"

        hour_date = hour_new

        return add_hours(person, cl.add_hour(hours, limit, 1), cod, day, month,
                         hour_date, year)
Esempio n. 2
0
 def add_H_Fnocturns(self, hr, cod):
     if cod == 1:
         self.h_Fnocturns = cl.add_hour(self.h_Fnocturns,hr,0)
     else:
         self.h_Fnocturns = cl.add_hour(self.h_Fnocturns,hr,1)
Esempio n. 3
0
 def add_H_diunrs(self, hr,cod):
     if cod == 1:
         self.h_diurns = cl.add_hour(self.h_diurns,hr,0)
     else:
         self.h_diurns = cl.add_hour(self.h_diurns,hr,1)