Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there, please assist me with implementing code for cancel a booking, please use the .csv format. I have included the full code snippets which

Hi there, please assist me with implementing code for cancel a booking, please use the ".csv" format. I have included the full code snippets which will give proper direction as to how the program should run. TIA
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
please use python to implement this code
cancel a booking instructions Cancel booking A student should be allowed to cancel their own booking. - Do not allow cancellation of empty slots - Do not allow cancellation of another student's booking - Cancelling the booking should not remove the Volunteer from the booking - The data file should be updated as well The file token+ json stores the uger" a acceas and refresh tokeng, and is ereated automatically when the authorization tlom completen for that itiot * time. if Os. path.exists ("token. json') : creds = Credentials. from authorized user file( SCOPES) If there are no (valid) credentials avallable, let the uaer log In. if not creds or not creds , valid: if creds and creds. expired and creds. refresh token: creds . refresh (Reguest()) else : flow = InstalledAppFlow.from_elient secrets-fi.e( 'credentials. json', SCOPES) ereds = flow.run_1ocal_gerver ( gortm0) * Save the credentiala for the next run with open('token. Json', 'w') as tokent token. write (creds .to json ()) tiy t service = build ("calendar', 'v3", credentialsacreds) print(" Authentification status: successful ") except Httperrot as error: print("An error oceurred: is " 8 error) create_file_data(systems_events, "data/systems_data.csv") def view_calendar (dataframe: pd) : Checks if calendar file exists if it exists then it displays the data if does not exist it will display a message " = todays_date = datetime . datetime. now () weekdays = ["Monday" , "Tuesday", "Wednesday", "Thursday", "F if datatrame, shape 01=0 : print("There are no planned events for the next 7 days") return None for in in range (7) : day = todays_date+datetime,timedelta (days=i) date =str( day )[:10] weekday = weekdays [datetime. datetime. weekday (day) ] events = dataframe[dataframe[ "date" ] wa date] print (weekday, date, end = ) if events, shape [0]=0 : print ("No events exists for this day ) and aiso checks it the date raH1s within seven days def student_booking( : =n Takes in students booking details then checks if there are a slotis that the student can choose from before booking a sess: wn df = pd. read_csv( "data/systems_data.csv") df = df [df "Event type" ]= "volunteer" 1 if df. shape [0]=0 : print("No volunteers are available for the next 7 days, return thone. view_calendar (de) date = get_usera_date( ) time = get usera time ( ) is_valid_date_and_time = check_volunteer_availability(date, if in valid date_and_time t deseription = get_users_deseription () ereate_event(date, time, description, "One on one", dele

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

1. What are your creative strengths?

Answered: 1 week ago

Question

What metaphors might describe how we work together?

Answered: 1 week ago