def add_new_donation_event(cursor_object):
        print("Adding new event...\n")
        time.sleep(1)
        clear()
        e1 = Event()
        while True:
            e1.date_of_event = input("Date of Event: ")
            if Validate.validate_date(e1.date_of_event) and e1.registration_in_tendays():
                pass
            else:
                print("\n\t ! The registration should be at least 10 days from now. ! ")
                print("\t   ! Use this format to enter date: 'YYYY.MM.DD' ! \n")
                time.sleep(2)
                clear()
                continue

            e1.start_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "Start Time: ", TIME_ERR)
            e1.end_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "End Time: ", TIME_ERR)
            while not e1.is_starttime_before_endtime():
                print("\n\t ! The starting time should be before the ending time. ! ")
                time.sleep(2)
                clear()
                e1.end_time = ""
                e1.end_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "End Time: ", TIME_ERR)

            e1.zip_code = EventManagerDB.data_into_event_object(e1, Validate.validate_zipcode, "ZIP code: ", ZIP_ERR)
            e1.city = EventManagerDB.data_into_event_object(e1, Validate.validate_city_name, "City: ", CITY_ERR)
            e1.address = EventManagerDB.data_into_event_object(e1, Validate.validate_address, "Address of event: ", ADDRESS_ERR)
            e1.available_beds = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "Available beds: ", POSINT_ERR)
            e1.planned_donor_number = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "Planned donor number: ", POSINT_ERR)

            e1.successfull = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "\n How many successfull donation was on the event?\n > ", POSINT_ERR)

            print("\nThe required functions: \n")

            print("Weekday :", e1.is_weekday())
            e1.duration = e1.calculate_duration()
            print("Duration: {} min  --  {} hours ".format(e1.duration, round(e1.duration/60, 1)))
            print("Maximum donor number:", e1.max_donor_number())
            print("Success rate: {}".format(e1.success_rate()))
            input("\n\n (Press ENTER to go BACK)")
            EventManagerDB.store_donation_data(e1, cursor_object)
            clear()
            break
 def test_exactly_20_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 20
     self.assertEqual(vampireparty.success_rate(), "Normal event")
 def test_exactly_75_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 75
     self.assertEqual(vampireparty.success_rate(), "Successfull")
 def test_exactly_110_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 110
     self.assertEqual(vampireparty.success_rate(), "Outstanding")
 def test_between_75_and_110_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 80
     self.assertEqual(vampireparty.success_rate(), "Successfull")
 def test_between_20_and_75_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 60
     self.assertEqual(vampireparty.success_rate(), "Normal event")
 def test_below_20_percent(self):
     vampireparty = Event()
     vampireparty.planned_donor_number = 100
     vampireparty.successfull = 19
     self.assertEqual(vampireparty.success_rate(), "Unsuccessfull, not worths to organise there again")
    def add_new_donation_event():
        print("Adding new event...\n")
        time.sleep(1)
        clear()
        e1 = Event()
        while True:
            e1.date_of_event = input("Date of Event: ")
            if Validate.validate_date(
                    e1.date_of_event) and e1.registration_in_tendays():
                pass
            else:
                print(
                    "\n\t ! The registration should be at least 10 days from now. ! "
                )
                print(
                    "\t   ! Use this format to enter date: 'YYYY.MM.DD' ! \n")
                time.sleep(2)
                clear()
                continue

            e1.start_time = EventManagerCSV.data_in_e(e1,
                                                      Validate.validate_time,
                                                      "Start Time: ", TIME_ERR)
            e1.end_time = EventManagerCSV.data_in_e(e1, Validate.validate_time,
                                                    "End Time: ", TIME_ERR)
            while not e1.is_starttime_before_endtime():
                print(
                    "\n\t ! The starting time should be before the ending time. ! "
                )
                time.sleep(2)
                clear()
                e1.end_time = ""
                e1.end_time = EventManagerCSV.data_in_e(
                    e1, Validate.validate_time, "End Time: ", TIME_ERR)

            e1.zip_code = EventManagerCSV.data_in_e(e1,
                                                    Validate.validate_zipcode,
                                                    "ZIP code: ", ZIP_ERR)
            e1.city = EventManagerCSV.data_in_e(e1,
                                                Validate.validate_city_name,
                                                "City: ", CITY_ERR)
            e1.address = EventManagerCSV.data_in_e(e1,
                                                   Validate.validate_address,
                                                   "Address of event: ",
                                                   ADDRESS_ERR)
            e1.available_beds = EventManagerCSV.data_in_e(
                e1, Validate.validate_positive_int, "Available beds: ",
                POSINT_ERR)
            e1.planned_donor_number = EventManagerCSV.data_in_e(
                e1, Validate.validate_positive_int, "Planned donor number: ",
                POSINT_ERR)

            e1.successfull = EventManagerCSV.data_in_e(
                e1, Validate.validate_positive_int,
                "\n How many successfull donation was on the event?\n > ",
                POSINT_ERR)

            print("\nThe required functions: \n")

            print("Weekday :", e1.is_weekday())
            e1.duration = e1.calculate_duration()
            print("Duration: {} min  --  {} hours ".format(
                e1.duration, round(e1.duration / 60, 1)))
            print("Maximum donor number:", e1.max_donor_number())
            print("Success rate: {}".format(e1.success_rate()))
            input("\n\n (Press ENTER to go BACK)")
            EventManagerCSV.store_donation_data(e1)
            clear()
            break