fix: allow scheduling evals if furture eval has been calcelled

This commit is contained in:
Jannat Patel
2025-03-04 17:33:39 +05:30
parent 486ce1bdb0
commit 6692252df9
2 changed files with 8 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
frappe.ui.form.on("LMS Certificate Request", {
refresh: function (frm) {
if (!frm.is_new()) {
if (!frm.is_new() && frm.doc.status == "Upcoming") {
frm.add_custom_button(
__("Create LMS Certificate Evaluation"),
() => {
@@ -14,7 +14,7 @@ frappe.ui.form.on("LMS Certificate Request", {
}
);
}
if (!frm.doc.google_meet_link) {
if (!frm.doc.google_meet_link && frm.doc.status == "Upcoming") {
frm.add_custom_button(__("Generate Google Meet Link"), () => {
frappe.call({
method: "lms.lms.doctype.lms_certificate_request.lms_certificate_request.setup_calendar_event",

View File

@@ -77,6 +77,7 @@ class LMSCertificateRequest(Document):
"member": self.member,
"course": self.course,
"name": ["!=", self.name],
"status": "Upcoming",
},
["date", "start_time", "course"],
)
@@ -150,7 +151,11 @@ def schedule_evals():
timelapse = add_to_date(get_datetime(), hours=-5)
evals = frappe.get_all(
"LMS Certificate Request",
{"creation": [">=", timelapse], "google_meet_link": ["is", "not set"]},
{
"creation": [">=", timelapse],
"google_meet_link": ["is", "not set"],
"status": "Upcoming",
},
["name", "member", "member_name", "evaluator", "date", "start_time", "end_time"],
)
for eval in evals: