react-weekly-planning 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -165,9 +165,10 @@ Props for the Calendar component.
165
165
 
166
166
  - **Description**: Checks if a new task overlaps with any existing tasks in the schedule. This function helps prevent overlapping tasks when scheduling.
167
167
  - **Parameters**:
168
- - `tasks` (TasksType): An array of existing tasks. Each task should have `taskStart` and `taskEnd` properties representing the start and end times of the task.
168
+ - `tasks` (TasksType): An array of existing tasks. Each task should have `groupId`,`taskStart` and `taskEnd` properties representing the groupId of new task, the start and end times of the task.
169
169
  - `taskStart` (number): The start time in milliseconds of the new task to be checked.
170
170
  - `taskEnd` (number): The end time in milliseconds of the new task to be checked.
171
+ - `groupId` (string): The groupId of new task.
171
172
  - **Returns**: `boolean` - Returns `true` if there is an overlap with any existing task, otherwise returns `false`.
172
173
 
173
174
 
package/index.js CHANGED
@@ -221,13 +221,13 @@ export const updateOffsetWithDateCalendar = (calendarDate) => {
221
221
  export const millisecondsToHours = (milliseconds) => {
222
222
  return millisecondsToDate(milliseconds).formattedDate;
223
223
  };
224
- export const checkDuplicates = (tasks, taskStart, taskEnd) => {
224
+ export const checkDuplicates = (tasks, taskStart, taskEnd, groupId) => {
225
225
  const findDuplicates = tasks === null || tasks === void 0 ? void 0 : tasks.filter((task) => (taskStart >= task.taskStart && taskStart < task.taskEnd) ||
226
226
  (taskEnd > task.taskStart && taskEnd < task.taskEnd) ||
227
227
  (taskStart <= task.taskStart &&
228
228
  taskEnd > task.taskStart &&
229
229
  taskEnd >= task.taskEnd &&
230
- taskStart <= task.taskEnd));
230
+ taskStart <= task.taskEnd)).filter((task) => task.groupId === groupId);
231
231
  return findDuplicates.length > 0;
232
232
  };
233
233
  export default Calendar;
package/index.tsx CHANGED
@@ -594,17 +594,20 @@ export const millisecondsToHours = (milliseconds: number) => {
594
594
  export const checkDuplicates = (
595
595
  tasks: TasksType,
596
596
  taskStart: number,
597
- taskEnd: number
597
+ taskEnd: number,
598
+ groupId: string
598
599
  ) => {
599
- const findDuplicates = tasks?.filter(
600
- (task) =>
601
- (taskStart >= task.taskStart && taskStart < task.taskEnd) ||
602
- (taskEnd > task.taskStart && taskEnd < task.taskEnd) ||
603
- (taskStart <= task.taskStart &&
604
- taskEnd > task.taskStart &&
605
- taskEnd >= task.taskEnd &&
606
- taskStart <= task.taskEnd)
607
- );
600
+ const findDuplicates = tasks
601
+ ?.filter(
602
+ (task) =>
603
+ (taskStart >= task.taskStart && taskStart < task.taskEnd) ||
604
+ (taskEnd > task.taskStart && taskEnd < task.taskEnd) ||
605
+ (taskStart <= task.taskStart &&
606
+ taskEnd > task.taskStart &&
607
+ taskEnd >= task.taskEnd &&
608
+ taskStart <= task.taskEnd)
609
+ )
610
+ .filter((task) => task.groupId === groupId);
608
611
  return findDuplicates.length > 0;
609
612
  };
610
613
  export default Calendar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-weekly-planning",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest",