fix: future date access on timetables for moderators

This commit is contained in:
Jannat Patel
2023-12-08 15:27:33 +05:30
parent 98ecb4c27c
commit c45a372e83
2 changed files with 8 additions and 4 deletions

View File

@@ -638,7 +638,8 @@
frappe.boot.single_types = []
let courses = {{ course_list | json }};
const legends = {{ legends | json }};
const allow_future = {{ batch_info.allow_future }}
const allow_future = {{ batch_info.allow_future }};
const is_student = "{{ is_student or '' }}";
const evaluation_end_date = "{{ batch_info.evaluation_end_date if batch_info.evaluation_end_date else '' }}"
</script>

View File

@@ -765,13 +765,16 @@ const add_links_to_events = (calendar) => {
calendar.on("clickEvent", ({ event }) => {
let event_date = event.start.d.d;
event_date = moment(event_date).format("YYYY-MM-DD");
let current_date = moment().format("YYYY-MM-DD");
if (!moment(event_date).isSameOrBefore(current_date) && !allow_future)
if (
is_student &&
!moment(event_date).isSameOrBefore(current_date) &&
!allow_future
)
return;
if (event.raw.milestone) {
if (is_student && event.raw.milestone) {
frappe.call({
method: "lms.lms.doctype.lms_batch.lms_batch.is_milestone_complete",
args: {