From 58b26b6e32739cede86aadf2e9a43a9f53c25888 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 19 Dec 2025 10:42:45 +0530 Subject: [PATCH] fix: increased schedule range to 60 days --- .../src/components/Modals/EvaluationModal.vue | 60 +++---------------- .../course_evaluator/course_evaluator.py | 4 +- 2 files changed, 9 insertions(+), 55 deletions(-) diff --git a/frontend/src/components/Modals/EvaluationModal.vue b/frontend/src/components/Modals/EvaluationModal.vue index 556ddc46..5d2bbd76 100644 --- a/frontend/src/components/Modals/EvaluationModal.vue +++ b/frontend/src/components/Modals/EvaluationModal.vue @@ -29,7 +29,7 @@
-
+
{{ dayjs(row.date).format('DD MMMM YYYY') }}
·
@@ -104,20 +104,13 @@ const evaluation = ref({ member: user.data.name, }) -const createEvaluation = createResource({ - url: 'frappe.client.insert', - makeParams(values) { - return { - doc: { - doctype: 'LMS Certificate Request', - batch_name: values.batch, - ...values, - }, - } - }, -}) - function submitEvaluation(close) { + if (!evaluation.value.date || !evaluation.value.start_time) { + toast.warning(__('Please select a slot for your evaluation.'), { + duration: 10, + }) + return + } call('frappe.client.insert', { doc: { doctype: 'LMS Certificate Request', @@ -133,35 +126,6 @@ function submitEvaluation(close) { console.log(err.messages?.[0] || err) toast.warning(__(err.messages?.[0] || err)) }) - /* createEvaluation.submit(evaluation.value, { - validate() { - if (!evaluation.value.course) { - return 'Please select a course.' - } - if (!evaluation.value.date) { - return 'Please select a date.' - } - if (!evaluation.value.start_time) { - return 'Please select a slot.' - } - if (dayjs(evaluation.value.date).isBefore(dayjs(), 'day')) { - return 'Please select a future date.' - } - if (dayjs(evaluation.value.date).isAfter(dayjs(props.endDate), 'day')) { - return `Please select a date before the end date ${dayjs( - props.endDate - ).format('DD MMMM YYYY')}.` - } - }, - onSuccess() { - evaluations.value.reload() - close() - }, - onError(err) { - console.log(err.messages?.[0] || err) - toast.warning(__(err.messages?.[0] || err), { duration: 10000 }) - }, - }) */ } const getCourses = () => { @@ -192,16 +156,6 @@ const slots = createResource({ }, }) -/* watch( - () => evaluation.date, - (date) => { - evaluation.start_time = '' - if (date && evaluation.course) { - slots.submit(evaluation) - } - } -) - */ watch( () => evaluation.value.course, (course) => { diff --git a/lms/lms/doctype/course_evaluator/course_evaluator.py b/lms/lms/doctype/course_evaluator/course_evaluator.py index bdfbcc30..6c8af0a6 100644 --- a/lms/lms/doctype/course_evaluator/course_evaluator.py +++ b/lms/lms/doctype/course_evaluator/course_evaluator.py @@ -174,10 +174,10 @@ def get_unavailable_dates(evaluator): def get_end_date(start_date, batch=None): - end_date = add_days(start_date, 30) + end_date = add_days(start_date, 60) if batch: batch_end_date = frappe.db.get_value("LMS Batch", batch, "evaluation_end_date") - if batch_end_date: + if batch_end_date and batch_end_date < getdate(end_date): end_date = getdate(batch_end_date) return end_date