def set_cars_nr(self, s): if s.isdigit() and int(s) >= 0: self.cars_nr = int(s) logger.debug("nr de masini a fost setat cu succes") else: self.is_valid = False logger.warning("Nr de masini")
def set_car(self, index, car_name, car_series, driver_name, missing_days, direction): __car = CarRecord() __car.index = index __car.name = car_name __car.series = car_series __car.direction = direction if driver_name == '': logger.error("Numele soferului %d este invalid" % index) __car.is_valid = False if driver_name[0].isupper() and all(x.isalpha() or x == " " for x in driver_name[1:]): __car.driver_name = driver_name else: logger.warning("Eroare la numele soferului: " + str(index)) __car.is_valid = False __tmp = list() if not missing_days == '': for el in missing_days.split(','): if el.isdigit( ): # todo implement additional checking according to date limits __tmp.append(int(el)) else: logger.warning( "Eroare in procesarea zilelor libere pentru masina: " + str(index)) __car.is_valid = False __car.miss_dates = __tmp logger.debug("Masina " + str(index) + " a fost procesata") self.cars.append(__car)
def set_days_nr(self, s): if s.isdigit() and int(s) >= 1: self.days_nr = int(s) logger.debug("nr de zile a fost setat cu succes") else: self.is_valid = False logger.warning("Nr de zile este invalid")
def set_par_index(self, s): if s.isdigit() and int(s) >= 1: self.parc_index = int(s) logger.debug("Indexul la parcurs a fost setat cu succes") else: self.is_valid = False logger.warning("indexul la parcurs este invalid")
def set_bord_index(self, s): if s.isdigit() and int(s) >= 1: self.bord_index = int(s) logger.debug("Indexul la borderou a fost setat cu succes") else: self.is_valid = False logger.warning("Indexul la borderoul este invalid")
def set_date(self, s): try: self.start_date = Date(*Date.string_to_default(s)) except Exception as ERR: logger.warning("Eroare la setarea datei: " + str(ERR)) self.is_valid = False else: logger.debug("Data a fost setata cu succes")
def set_parc_index_miss_dates(self, s): if not s: return temp = list(s.split('-')) if len(temp) == 2 and temp[0].isdigit() and temp[1].isdigit(): self.parc_index_miss_dates = [int(x) for x in temp] print(temp) logger.debug("Indexurile lipsa setate cu success") else: self.is_valid = False logger.warning("Indexruile la data lipsa nu pot fi setate")