From 48eb2ff4052dd59995bec7267776b8862139f456 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 16 Apr 2025 11:18:17 +0530 Subject: [PATCH] fix: registration button should be visible if batch starts today but a few hours are left --- lms/lms/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 3a2a693e..9a39b4a9 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -8,7 +8,6 @@ import requests from frappe import _ from frappe.desk.doctype.dashboard_chart.dashboard_chart import get_result from frappe.desk.doctype.notification_log.notification_log import make_notification_logs -from frappe.desk.search import get_user_groups from frappe.desk.notifications import extract_mentions from frappe.utils import ( add_months, @@ -20,7 +19,6 @@ from frappe.utils import ( format_date, get_datetime, getdate, - validate_phone_number, get_fullname, pretty_date, get_time_str, @@ -1390,6 +1388,13 @@ def get_batch_details(batch): batch_details.instructors = get_instructors(batch) batch_details.accept_enrollments = batch_details.start_date > getdate() + if ( + not batch_details.accept_enrollments + and batch_details.start_date == getdate() + and get_time_str(batch_details.start_time) > nowtime() + ): + batch_details.accept_enrollments = True + batch_details.courses = frappe.get_all( "Batch Course", filters={"parent": batch}, fields=["course", "title", "evaluator"] )