event=self.event_factory.create_event(name,organizer,description)# Create an Event object using the "event_factory" instance variable and the input from the user
event=self.event_factory.create_event(name,organizer,description)# Create an Event object using the "event_factory" instance variable and the input from the user
self.events.append(event)# Add the newly created event object to the list stored in the "events" instance variable
self.events.append(event)# Add the newly created event object to the list stored in the "events" instance variable
print(f"Event {name} created successfully!")# Print a message confirming the event has been created
print(f"Event {name} created successfully!")# Print a message confirming the event has been created
...
@@ -86,8 +90,12 @@ class EventView:
...
@@ -86,8 +90,12 @@ class EventView:
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the parameter "event_name" or return None
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the parameter "event_name" or return None
ifevent:
ifevent:
name=input("\nEnter Plus one invitee name: ")# Prompt the user for input and assign it to the variable "name"
name=input("\nEnter Plus one invitee name: ")# Prompt the user for input and assign it to the variable "name"
rsvp=input("Has Plus one invitee RSVPd? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
rsvp=input("Has Plus one invitee RSVPd? (y/n) *Pressing enter to skips will be considered <No>").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
ifname.strip()==""ordietary_req.strip()=="":
print("Please provide all values. Try Again")
else:
invitee=self.event_factory.create_invitee(name,rsvp,False,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user, with the plus_one attribute set to true
invitee=self.event_factory.create_invitee(name,rsvp,False,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user, with the plus_one attribute set to true
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
print(f"Invitee {name} added to event {event_name} as plus One")# Print a message confirming the invitee has been added as plus one
print(f"Invitee {name} added to event {event_name} as plus One")# Print a message confirming the invitee has been added as plus one
...
@@ -96,12 +104,18 @@ class EventView:
...
@@ -96,12 +104,18 @@ class EventView:
defadd_invitee(self):
defadd_invitee(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
ifevent_name.strip()=="":
print("Please provide a proper event name")
else:
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
ifevent:
name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "name"
name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "name"
rsvp=input("Has invitee RSVPd? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
rsvp=input("Has invitee RSVPd? (y/n) *Pressing enter to skip will be considered <No>").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
plus_one=input("Is invitee bringing a plus one? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "plus_one"
plus_one=input("Is invitee bringing a plus one? (y/n) *Pressing enter to skips will be considered <No> ").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "plus_one"
ifname.strip()==""ordietary_req.strip()=="":
print("Please provide all values")
else:
ifplus_one:
ifplus_one:
self.addPlusOne(event_name)# If the invitee is bringing a plus one, call the addPlusOne method and pass the event_name
self.addPlusOne(event_name)# If the invitee is bringing a plus one, call the addPlusOne method and pass the event_name
invitee=self.event_factory.create_invitee(name,rsvp,plus_one,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user
invitee=self.event_factory.create_invitee(name,rsvp,plus_one,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user
...
@@ -112,6 +126,9 @@ class EventView:
...
@@ -112,6 +126,9 @@ class EventView:
defview_invitees(self):
defview_invitees(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
ifevent_name.strip()=="":
print("Please provide a proper event name")
else:
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
ifevent:
event.view_invitees()# call the view_invitees method on the event object
event.view_invitees()# call the view_invitees method on the event object
...
@@ -120,9 +137,15 @@ class EventView:
...
@@ -120,9 +137,15 @@ class EventView:
defadd_menu_item(self):
defadd_menu_item(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
invitee_name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "invitee_name"
invitee_name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "invitee_name"
ifinvitee_name.strip()=="":
print("Please provide a proper name")
else:
foreventinself.events:# Iterate through the list stored in the instance variable "events"
foreventinself.events:# Iterate through the list stored in the instance variable "events"
invitee=next((xforxinevent.inviteesifx.name==invitee_name),None)# Iterate through the list of invitees of the event and return the first invitee object whose "name" attribute matches the input invitee_name or return None
invitee=next((xforxinevent.inviteesifx.name==invitee_name),None)# Iterate through the list of invitees of the event and return the first invitee object whose "name" attribute matches the input invitee_name or return None
ifinvitee:
ifinvitee:
...
@@ -154,32 +183,41 @@ class EventView:
...
@@ -154,32 +183,41 @@ class EventView:
defselect_menu(self):
defselect_menu(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
ifinvitee:#If the event exists in the list of events and if the list of invitee contains the variable invitee_name, start the while loop.
ifinvitee:#If the event exists in the list of events and if the list of invitee contains the variable invitee_name, start the while loop.
whileTrue:#The while loop will not end unless something returns False
whileTrue:#The while loop will not end unless something returns False
iflen(event.menu.items)>0:#If the length of an item list is more than 0, continue.
iflen(event.menu.items)>0:#If the length of an item list is more than 0, continue.
meal_name=input("What are you having? : ")#Prompt the user for input and assign it to the variable meal_name
meal_name=input("What are you having? : ")#Prompt the user for input and assign it to the variable meal_name
ifmeal_nameinevent.menu.items:#If the given meal_name from the invitee is in the menu, order is successful and the invitee_name and the ordered meal get stored.
ifmeal_nameinevent.menu.itemsandmeal_name.strip()!="":#If the given meal_name from the invitee is in the menu, order is successful and the invitee_name and the ordered meal get stored.
event.track_invitee_meals[invitee_name]=meal_name
event.track_invitee_meals[invitee_name]=meal_name
print("Ordered Successfully")
print("Ordered Successfully")
returnFalse
returnFalse
else:
else:
print(f"{meal_name} not found. try again.")# Print an error message if the meal name is not found
print(f"{meal_name} not found. try again.")
returnTrue
returnTrue
else:
else:
print("Add menu before selecting menu.")# Print a prompt message to add menu item before selcting a menu
print("Add menu before selecting menu.")
returnFalse
returnFalse
else:
else:
print(f"{invitee_name} is not in the invitee_list")# Print an error message if the invitee is not in the invitee list
print(f"{invitee_name} is not in the invitee_list")
else:
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
print(f"Event {event_name} not found.")
deftrack_meals(self):
deftrack_meals(self):
event_name=input("Enter event name: ")#Prompt the user for input and assign it to the variable event_name
event_name=input("Enter event name: ")#Prompt the user for input and assign it to the variable event_name