Merge pull request #1928 from pateljannat/issues-164

fix: misc issues
This commit is contained in:
Jannat Patel
2025-12-23 11:08:06 +05:30
committed by GitHub
5 changed files with 16 additions and 6 deletions

View File

@@ -196,8 +196,8 @@ const job = createResource({
onSuccess: (data) => {
if (user.data?.name) {
jobApplication.submit()
applicationCount.submit()
}
applicationCount.submit()
},
})

View File

@@ -43,8 +43,12 @@ class TestCourseEvaluator(UnitTestCase):
def calculated_first_date_of_schedule(self):
today = getdate()
offset = (0 - today.weekday() + 7) % 7 # 0 for Monday
first_date = add_days(today, offset)
offset_monday = (0 - today.weekday() + 7) % 7 # 0 for Monday
offset_wednesday = (2 - today.weekday() + 7) % 7 # 2 for Wednesday
if offset_monday < offset_wednesday:
first_date = add_days(today, offset_monday)
else:
first_date = add_days(today, offset_wednesday)
return first_date
def calculated_last_date_of_schedule(self, first_date):

View File

@@ -39,7 +39,7 @@ class LMSEnrollment(Document):
"reference_doctype": "LMS Course",
"reference_docname": self.course,
"member": self.member,
"payment_receipt": True,
"payment_received": True,
},
)

View File

@@ -76,6 +76,7 @@
],
"fields": [
{
"default": "https://falcon.frappe.io/",
"fieldname": "livecode_url",
"fieldtype": "Data",
"label": "LiveCode URL"
@@ -451,7 +452,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-12-10 17:36:15.689695",
"modified": "2025-12-22 11:30:13.868031",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Settings",

View File

@@ -1800,7 +1800,7 @@ def validate_enrollment_eligibility(batch_doc, payment_doc=None):
if not payment_doc or not payment_doc.payment_received:
frappe.throw(_("Payment is required to enroll in this batch."))
elif not batch_doc.allow_self_enrollment:
elif not batch_doc.allow_self_enrollment and not is_admin():
frappe.throw(_("Enrollment in this batch is restricted. Please contact the Administrator."))
students = frappe.db.count("LMS Batch Enrollment", {"batch": batch_doc.name})
@@ -1808,6 +1808,11 @@ def validate_enrollment_eligibility(batch_doc, payment_doc=None):
frappe.throw(_("There are no seats available in this batch."))
def is_admin():
roles = frappe.get_roles(frappe.session.user)
return "Course Creator" in roles or "Moderator" in roles or "Batch Evaluator" in roles
def create_enrollment(batch, payment_doc=None):
new_student = frappe.new_doc("LMS Batch Enrollment")
new_student.update(