commit
f044731e2f
1 changed files with 12 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|||
|
||||
import { findColor } from 'containers/Rotations/Rotations.helpers';
|
||||
import { getLayersFromStore, getOverridesFromStore, getShiftsFromStore } from 'models/schedule/schedule.helpers';
|
||||
import { Event } from 'models/schedule/schedule.types';
|
||||
import { Event, Layer } from 'models/schedule/schedule.types';
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
import { RootStore } from 'state';
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ export const getDateTime = (date: string) => {
|
|||
return dayjs(date);
|
||||
};
|
||||
|
||||
|
||||
export const getColorSchemeMappingForUsers = (
|
||||
store: RootStore,
|
||||
scheduleId: string,
|
||||
|
|
@ -26,15 +25,21 @@ export const getColorSchemeMappingForUsers = (
|
|||
): { [userId: string]: Set<string> } => {
|
||||
const usersColorSchemeHash: { [userId: string]: Set<string> } = {};
|
||||
|
||||
const shifts = getShiftsFromStore(store, scheduleId, startMoment);
|
||||
const layers = getLayersFromStore(store, scheduleId, startMoment);
|
||||
const finalScheduleShifts = getShiftsFromStore(store, scheduleId, startMoment);
|
||||
const layers: Layer[] = getLayersFromStore(store, scheduleId, startMoment);
|
||||
const overrides = getOverridesFromStore(store, scheduleId, startMoment);
|
||||
|
||||
if (!shifts?.length || !layers?.length) {
|
||||
if (!finalScheduleShifts?.length || !layers?.length) {
|
||||
return usersColorSchemeHash;
|
||||
}
|
||||
|
||||
shifts.forEach(({ shiftId, events }) => populateUserHashSet(events, shiftId));
|
||||
const rotationShifts = layers.reduce((prev, current) => {
|
||||
prev.push(...current.shifts);
|
||||
return prev;
|
||||
}, []);
|
||||
|
||||
finalScheduleShifts.forEach(({ shiftId, events }) => populateUserHashSet(events, shiftId));
|
||||
rotationShifts.forEach(({ shiftId, events }) => populateUserHashSet(events, shiftId));
|
||||
|
||||
return usersColorSchemeHash;
|
||||
|
||||
|
|
@ -49,4 +54,4 @@ export const getColorSchemeMappingForUsers = (
|
|||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue