fix:formatting

This commit is contained in:
0Pranav 2019-11-07 12:54:48 +05:30
parent 75db6f7073
commit 51208b3f0b

View File

@ -37,9 +37,9 @@ def get_appointment_slots(date, timezone):
date + ' 00:00:00', format_string) date + ' 00:00:00', format_string)
query_end_time = datetime.datetime.strptime( query_end_time = datetime.datetime.strptime(
date + ' 23:59:59', format_string) date + ' 23:59:59', format_string)
query_start_time = convert_to_system_timezone(timezone,query_start_time) query_start_time = convert_to_system_timezone(timezone, query_start_time)
query_end_time = convert_to_system_timezone(timezone,query_end_time) query_end_time = convert_to_system_timezone(timezone, query_end_time)
now = convert_to_guest_timezone(timezone,datetime.datetime.now()) now = convert_to_guest_timezone(timezone, datetime.datetime.now())
# Database queries # Database queries
settings = frappe.get_doc('Appointment Booking Settings') settings = frappe.get_doc('Appointment Booking Settings')
@ -50,7 +50,7 @@ def get_appointment_slots(date, timezone):
# Filter and convert timeslots # Filter and convert timeslots
converted_timeslots = [] converted_timeslots = []
for timeslot in timeslots: for timeslot in timeslots:
converted_timeslot = convert_to_guest_timezone(timezone,timeslot) converted_timeslot = convert_to_guest_timezone(timezone, timeslot)
# Check if holiday # Check if holiday
if _is_holiday(converted_timeslot.date(), holiday_list): if _is_holiday(converted_timeslot.date(), holiday_list):
converted_timeslots.append( converted_timeslots.append(
@ -98,15 +98,15 @@ def create_appointment(date, time, tz, contact):
scheduled_time = datetime.datetime.strptime( scheduled_time = datetime.datetime.strptime(
date+" "+time, format_string) date+" "+time, format_string)
scheduled_time = scheduled_time.replace(tzinfo=None) scheduled_time = scheduled_time.replace(tzinfo=None)
scheduled_time = convert_to_system_timezone(tz,scheduled_time) scheduled_time = convert_to_system_timezone(tz, scheduled_time)
scheduled_time= scheduled_time.replace(tzinfo=None) scheduled_time = scheduled_time.replace(tzinfo=None)
appointment.scheduled_time = scheduled_time appointment.scheduled_time = scheduled_time
contact = json.loads(contact) contact = json.loads(contact)
appointment.customer_name = contact['name'] appointment.customer_name = contact.get('name',None)
appointment.customer_phone_number = contact['number'] appointment.customer_phone_number = contact.get('number', None)
appointment.customer_skype = contact['skype'] appointment.customer_skype = contact.get('skype', None)
appointment.customer_details = contact['notes'] appointment.customer_details = contact.get('notes', None)
appointment.customer_email = contact['email'] appointment.customer_email = contact.get('email', None)
appointment.status = 'Open' appointment.status = 'Open'
appointment.insert() appointment.insert()