From 8c0c09a21b2b6032e1ac38259dc029ea3e1a86b1 Mon Sep 17 00:00:00 2001 From: saadindictrans Date: Fri, 27 Oct 2023 11:33:18 +0530 Subject: [PATCH] Fix:timetable validation --- lms/lms/doctype/lms_batch/lms_batch.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lms/lms/doctype/lms_batch/lms_batch.py b/lms/lms/doctype/lms_batch/lms_batch.py index ea368a7e0..cf371f557 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -12,6 +12,7 @@ cint, format_date, format_datetime, + get_time, ) from lms.lms.utils import get_lessons, get_lesson_index, get_lesson_url from lms.www.utils import get_quiz_details, get_assignment_details @@ -116,23 +117,27 @@ def validate_seats_left(self): def validate_timetable(self): for schedule in self.timetable: if schedule.start_time and schedule.end_time: - if ( - schedule.start_time > schedule.end_time or schedule.start_time == schedule.end_time - ): + if get_time(schedule.start_time) > get_time(schedule.end_time) or get_time( + schedule.start_time + ) == get_time(schedule.end_time): frappe.throw( _("Row #{0} Start time cannot be greater than or equal to end time.").format( schedule.idx ) ) - if schedule.start_time < self.start_time or schedule.start_time > self.end_time: + if get_time(schedule.start_time) < get_time(self.start_time) or get_time( + schedule.start_time + ) > get_time(self.end_time): frappe.throw( _("Row #{0} Start time cannot be outside the batch duration.").format( schedule.idx ) ) - if schedule.end_time < self.start_time or schedule.end_time > self.end_time: + if get_time(schedule.end_time) < get_time(self.start_time) or get_time( + schedule.end_time + ) > get_time(self.end_time): frappe.throw( _("Row #{0} End time cannot be outside the batch duration.").format(schedule.idx) )