Premium support for our pure JavaScript UI components


Post by til.schniese »

Hi team,

I am having the following problem with dependency lag in combination with calendars in SchedulerPro. Let's look at an example:

  1. Let's assume we have event A and event B, both with a duration of 2, and there is a dependency between them from the end of A to the start of B. Also, this dependency has a lag of 1 (unit is hours here).

    Screenshot 2022-12-09 at 16.28.27.png
    Screenshot 2022-12-09 at 16.28.27.png (10.33 KiB) Viewed 1532 times
  2. Now, we also use a calendar to specify the working times of the events. For this calendar, we have a non-working time interval that is exactly the time span that is currently the gap between A and B. Thus, B needs to be rescheduled to start one hour later to satisfy the lag definition. The events will now look like this:

    Screenshot 2022-12-09 at 16.39.50.png
    Screenshot 2022-12-09 at 16.39.50.png (9.6 KiB) Viewed 1532 times
  3. Here is the thing: When the interval was added during the initial load, this rescheduling happens perfectly, and the events end up in the correct state. BUT: When we modify the calendar later on, no rescheduling happens, A and B just reside in the same position as they were in 1.

To update the calendar, I am using the addIntervals method. Below is the code for this example, which is adapted from one of the SchedulerPro examples, you can plug it into the examples (added comments to test the cases).

This bug actually leads to incorrectly scheduled events for us, so I am looking forward to your response. Thanks.

import { SchedulerPro } from '../../build/schedulerpro.module.js';
import shared from '../_shared/shared.module.js';

// region Data

const resources = [{ id: 'r1', name: 'Mike' }];
const events = [
  {
    id: 1,
    resourceId: 'r1',
    startDate: new Date(2017, 0, 1, 10),
    endDate: new Date(2017, 0, 1, 12),
    name: 'A',
    iconCls: 'b-fa b-fa-mouse-pointer',
    calendar: 'start',
  },
  {
    id: 2,
    resourceId: 'r1',
    startDate: new Date(2017, 0, 1, 13),
    endDate: new Date(2017, 0, 1, 15),
    name: 'B',
    iconCls: 'b-fa b-fa-arrows-alt',
    calendar: 'start',
  },
];

const dependencies = [
  {
    id: 't',
    from: 1,
    to: 2,
    lag: 60,
    lagUnit: 'm',
  },
];

const interval = {
  isWorking: false,
  startDate: new Date(2017, 0, 1, 12),
  endDate: new Date(2017, 0, 1, 13),
};

const calendars = [
  {
    id: 'start',
    // Case 1: When directly adding the interval, rescheduling works.
    // Comment out to test case 2.
    intervals: [
      interval
    ],
    unspecifiedTimeIsWorking: true,
  },
];

// endregion

const scheduler = new SchedulerPro({
  appendTo: 'container',
  resources,
  events,
  dependencies,
  calendars,
  features: {
    dependencies: true,
    dependencyEdit: true,
  },
  startDate: new Date(2017, 0, 1, 6),
  endDate: new Date(2017, 0, 1, 20),
  viewPreset: 'hourAndDay',
  rowHeight: 50,
  barMargin: 5,
  multiEventSelect: true,
  columns: [{ text: 'Name', field: 'name', width: 130 }],
});

setTimeout(() => {
  // Case 2: When adding the interval later, the rescheduling does not work.
  // Comment out to test case 1.
  scheduler.calendars[0].addIntervals([interval]);
  console.log(scheduler.calendars[0].intervals);
}, 2000);

Post by tasnim »

Hi til.schniese,

It's a bug, We already have a ticket on that. Here it is https://github.com/bryntum/support/issues/2176
I've also added that you've reported this bug.

Good Luck :)
Tasnim


Post by til.schniese »

Hi tasnim,

thanks for your answer already. I am afraid I am not yet satisfied with this. I don't think the issue you linked is reflecting the problem adequately.

Because: Adding non-working intervals dynamically does recalculate tasks correctly when the non-working time overlaps with the event. But, my problem is: It does not work when only the dependency lag overlaps (is affected by the change), but not the dependent event directly, while this works for the initial load.

We are currently trying to implement this: viewtopic.php?p=113407#p113407
TL;DR for this ticket: We want to move away from constraints, but rely on dependency lags instead. But right now, we can't do it because of this bug. Thus, getting this fixed is very important for us to proceed.

My question would be: Can you give me an estimate on how hard it would be to get this fixed? I assume as it works for the initial load, this kind of logic must already exist somewhere, so maybe it can be fixed easily? We really need it. Thanks a lot.


Post by mats »

We will look into it very soon, thanks for your patience!


Post by til.schniese »

Thanks, I appreciate! Can you maybe still give me some kind of ETA? Would be very helpful, thanks


Post by mats »

Late December or Early January release most likely.


Post by til.schniese »

Hi again,

I just found another rather serious bug for us, that seems to be related to the vue package of SchedulerPro.

The issue is that the scheduling stops working, after resetting the events array passed in as a prop to the vue component. Below is a video of the problem. The transcript is like this:

  1. For two events A, B with dependency from the end of A to the start of B, I am moving A to start one day earlier. This will correctly update B.
  2. Now, I am resetting the events array to the initial dates (it's an actual reset of the array). As expected, both A and B jump back to the initial position
  3. I do the same as in 1. and move A to start one day earlier. Now, B is not updated.
Screen Recording 2022-12-14 at 11.57.38.mov
(743.13 KiB) Downloaded 19 times

This is the code for this example:

<template>
  <button @click="reset"> reset</button>
  <BryntumSchedulerPro
    ref="scheduler"
    v-bind="{
      ...schedulerConfig,
      height: `calc(100vh - 100px)`,
      width: 'calc(100vw - 30px)',
      events,
      resources,
      dependencies
    }"
  />
</template>


<script setup>
import { EventStore } from '@bryntum/schedulerpro';
import { BryntumSchedulerPro } from '@bryntum/schedulerpro-vue-3';
import { ref } from 'vue';

const scheduler = ref();

const resources = ref([
  {
    id: 'resource',
    name: 'My Resource',
  },
]);
const initialEvents = [
  {
    id: 'event',
    name: 'My Event',
    resourceId: 'resource',
    startDate: new Date(2022, 1, 3),
    endDate: new Date(2022, 1, 4),
  },
  {
    id: 'event-2',
    name: 'My Event 2',
    resourceId: 'resource',
    startDate: new Date(2022, 1, 5),
    endDate: new Date(2022, 1, 6),
  },
]
const events = ref([...initialEvents]);

const reset = ()=> {
  events.value = [...initialEvents]
}

const dependencies = ref([
  {
    id: 'dependency',
    from: 'event',
    to: 'event-2',
    lag: 1,
    lagUnit: 'd'
  }
])

const eventStore = new EventStore({
  listeners: {
    change: (event) => {
      if (event.action !== 'update') return;
      console.log(event)
    },
  },
});

const schedulerConfig =  {
  viewPreset: 'dayAndWeek',
  startDate: new Date(2022, 1, 1),
  endDate: new Date(2022, 2, 1),
  eventStore,
  columns: [
    {
      text: '',
      field: 'name',
      width: 130,
    },
  ],
}
</script>


<style>
@import '~@bryntum/schedulerpro/schedulerpro.material.css';
</style>

This again causes some serious bugs in scheduling for us, and it would be great if you could help me out here. Thanks a lot. Do you maybe have an idea for a quick workaround so I don't need to wait until it got fixed?


Post by tasnim »

Hello,
I've tried to reproduce it with the VUE and vanilla js example but I wasn't able to reproduce it. Could you please upload a test case so we can reproduce and debug it?


Post by til.schniese »

Attached is the test vue app I used, which includes the same code as I added above. Do you need anything else?

Attachments
test-app.zip
(386.69 KiB) Downloaded 19 times

Post by tasnim »

Thanks for the test case. I've reproduced it. I've created a ticket to investigate it https://github.com/bryntum/support/issues/5788

Good Luck :)


Post Reply