Skip to content

Commit

Permalink
Merge pull request #700 from pateljannat/fix-milestones
Browse files Browse the repository at this point in the history
fix: future date access on timetables for moderators
  • Loading branch information
pateljannat authored Dec 8, 2023
2 parents 98ecb4c + c45a372 commit 0e2fabf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lms/www/batches/batch.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
9 changes: 6 additions & 3 deletions lms/www/batches/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 0e2fabf

Please sign in to comment.