fix: course and bath category filter issue

This commit is contained in:
Jannat Patel
2026-01-19 12:38:12 +05:30
parent c97a5e813c
commit 0883aedc1d
4 changed files with 22 additions and 29 deletions

View File

@@ -32,7 +32,7 @@ ALLOWED_PATHS = [
"/api/method/frappe.onboarding.get_onboarding_status",
"/api/method/frappe.utils.print_format.download_pdf",
"/api/method/frappe.desk.search.search_link",
"/api/method/frappe.core.doctype.communication.email.make_email",
"/api/method/frappe.core.doctype.communication.email.make",
]
@@ -53,7 +53,6 @@ def authenticate():
if path.startswith("/lms") or path.startswith("/api/method/lms."):
return
print(ALLOWED_PATHS)
if path in ALLOWED_PATHS:
return
frappe.throw(f"Access not allowed for this URL: {path}", frappe.PermissionError)

View File

@@ -5,7 +5,7 @@
from frappe.tests import UnitTestCase
from frappe.utils import add_days, format_time, getdate
from lms.lms.doctype.course_evaluator.course_evaluator import get_schedule
from lms.lms.doctype.course_evaluator.course_evaluator import get_schedule, get_schedule_range_end_date
from lms.lms.test_utils import TestUtils
@@ -51,17 +51,10 @@ class TestCourseEvaluator(UnitTestCase):
first_date = add_days(today, offset_wednesday)
return first_date
def calculated_last_date_of_schedule(self, first_date):
last_day = add_days(getdate(), 56)
offset_monday = (0 - last_day.weekday() + 7) % 7 # 0 for Monday
offset_wednesday = (2 - last_day.weekday() + 7) % 7 # 2 for Wednesday
if offset_monday < offset_wednesday and offset_monday <= 4:
last_day = add_days(last_day, offset_monday)
elif offset_wednesday <= 4:
last_day = add_days(last_day, offset_wednesday)
else:
last_day = add_days(last_day, min(offset_monday, offset_wednesday) + 7)
def calculated_last_date_of_schedule(self):
last_day = getdate(get_schedule_range_end_date(getdate(), self.batch.name))
while last_day.weekday() not in (0, 2):
last_day = add_days(last_day, -1)
return last_day