Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: timetable validation #663

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lms/lms/doctype/lms_batch/lms_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -117,22 +118,22 @@ 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
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)
)
Expand Down
Loading