Apply suggestions from code review

Co-Authored-By: Shivam Mishra <scmmishra@users.noreply.github.com>
This commit is contained in:
Pranav Nachnekar 2019-11-05 04:32:06 +00:00 committed by GitHub
parent af18b2cdc5
commit 4d3dc87a1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,12 +23,12 @@ class AppointmentBookingSettings(Document):
to_time = datetime.datetime.strptime(
self.min_date+record.to_time, self.format_string)
timedelta = to_time-from_time
self.from_time_is_later_than_to_time(from_time, to_time)
self.validate_from_and_to_time(from_time, to_time)
self.duration_is_divisible(from_time, to_time)
def from_time_is_later_than_to_time(self, from_time, to_time):
def validate_from_and_to_time(self, from_time, to_time):
if from_time > to_time:
err_msg = 'From Time cannot be later than To Time for '+record.day_of_week
err_msg = _(''<b>From Time</b> cannot be later than <b>To Time</b> for {0}'').format(record.day_of_week)
frappe.throw(_(err_msg))
def duration_is_divisible(self, from_time, to_time):