def observation_details_of_a_given_animal_between_specified_dates(): print( "--Observation details of a given animal between specified dates--" ) header = f"Date\tTime\tAnimal Weight\tTemperature\tNote\tStaff\n" animal = animal_parser() start_date = date_parser("Start Date") end_date = date_parser("End Date") result = [ i for i in animal.observation_record if start_date <= i.date <= end_date ] if len(result) == 0: print("No result.") ReportOperations.write_report( "observation_details_of_a_given_animal_between_specified_dates.txt", "No result.", header) else: print(header, end="") [print(i) for i in result] ReportOperations.write_report( "observation_details_of_a_given_animal_between_specified_dates.txt", result, header)
def add_feeding_record_given_animal(): print("--Add feeding details of a given animal--") animal = animal_parser() date = date_parser("Date") if len([item for item in animal.feeding_record if item.date == date]) < 2: time = time_parser() food = food_parser() weight = int(input("Enter Weight:")) staff = staff_parser() animal.feeding_record.append(FeedingRecord(date, time, food, weight, staff)) print("Record added.") else: raise Exception(f"Animal NO:{animal.no} should not be fed more than two times in a day")
def add_observation_record_given_animal(): print("--Add observation details of a given animal--") animal = animal_parser() date = date_parser("Date") if len([item for item in animal.observation_record if item.date == date]) < 3: time = time_parser() animal_weight = int(input("Enter Animal Weight:")) temperature = int(input("Enter Temperature:")) note = input("Enter Note:") staff = staff_parser() animal.observation_record.append(ObservationRecord(date, time, animal_weight, temperature, note, staff)) print("Record added.") else: raise Exception(f"Animal NO:{animal.no} should not be observed more than three times in a day")
def foods_that_have_been_fed_to_a_given_animal(): print("--Foods that have been fed to a given animal--") header = f"Food Name\tManufacturer\n" animal = animal_parser() result_set = {record.food for record in animal.feeding_record} if len(result_set) == 0: print("No result.") ReportOperations.write_report( "foods_that_have_been_fed_to_a_given_animal.txt", "No result.", header) else: print(header, end="") [print(f) for f in result_set] ReportOperations.write_report( "foods_that_have_been_fed_to_a_given_animal.txt", result_set, header)
def staff_who_have_observed_a_given_animal(): print("--Staff who have observed a given animal--") header = f"ID\tFirst Name\tLast Name\tOffice\tTel\n" animal = animal_parser() result_set = {record.staff for record in animal.observation_record} if len(result_set) == 0: print("No result.") ReportOperations.write_report( "staff_who_have_observed_a_given_animal.txt", "No result.", header) else: print(header, end="") [print(s) for s in result_set] ReportOperations.write_report( "staff_who_have_observed_a_given_animal.txt", result_set, header)
def feeding_details_of_a_given_animal_between_specified_dates(): print("--Feeding details of a given animal between specified dates--") header = f"Date\tTime\tFood Name\tManufacturer\tWeight\tStaff\n" animal = animal_parser() start_date = date_parser("Start Date") end_date = date_parser("End Date") result = [ i for i in animal.feeding_record if start_date <= i.date <= end_date ] if len(result) == 0: print("No result.") ReportOperations.write_report( "feeding_details_of_a_given_animal_between_specified_dates.txt", "No result.", header) else: print(header, end="") [print(i) for i in result] ReportOperations.write_report( "feeding_details_of_a_given_animal_between_specified_dates.txt", result, header)