From 881c3d943ae1508500d87f5a4137560030af443e Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Dec 2023 20:06:43 +0530 Subject: [PATCH] fix: evaluation fields --- .../lms_certificate_evaluation.json | 7 ++++--- .../lms_certificate_evaluation.py | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json index 998ce8bce..d698fe17c 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json @@ -47,12 +47,13 @@ "fieldtype": "Rating", "in_list_view": 1, "label": "Rating", - "reqd": 1 + "mandatory_depends_on": "eval:doc.status != 'Pending' && doc.status != 'In Progress'" }, { "fieldname": "summary", "fieldtype": "Small Text", - "label": "Summary" + "label": "Summary", + "mandatory_depends_on": "eval:doc.status != 'Pending' && doc.status != 'In Progress'" }, { "fieldname": "date", @@ -106,7 +107,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-09-26 19:44:43.594892", + "modified": "2023-12-18 20:03:27.040073", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Evaluation", diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.py b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.py index 82105486f..7485d135a 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.py +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.py @@ -8,7 +8,12 @@ class LMSCertificateEvaluation(Document): - pass + def validate(self): + self.validate_rating() + + def validate_rating(self): + if self.status not in ["Pending", "In Progress"] and self.rating == 0: + frappe.throw("Rating cannot be 0") def has_website_permission(doc, ptype, user, verbose=False):