Skip to content

Commit 48654cf

Browse files
committed
removed debug logs
1 parent 2fced81 commit 48654cf

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

library/src/components/timetable/timeTableUtils.ts

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,19 @@ export function getLeftAndWidth(
432432
}
433433

434434
const slotStart = slotsArray[startSlot]
435+
const ddaysDiff = itemModStart.diff(slotStart, "day")
436+
const startDiffDays = ddaysDiff * timeFrameDay.oneDayMinutes
437+
438+
const dayStartDiff =
439+
viewType === "hours"
440+
? 0
441+
: timeFrameDay.startHour * 60 + timeFrameDay.startMinute
442+
const startSum = startDiffDays + dayStartDiff
443+
444+
const slotStartDiff = itemModStart.diff(slotStart, "minute")
445+
446+
const left = (slotStartDiff - startSum) / timeSlotMinutes
435447

436-
const dstartMin = itemModStart.diff(slotStart, "minute")
437-
let left = dstartMin / timeSlotMinutes
438448
if (left < 0) {
439449
console.error(
440450
"LPTimeTable - item with negative left found:",
@@ -445,35 +455,15 @@ export function getLeftAndWidth(
445455
slotsArray,
446456
timeSlotMinutes,
447457
)
448-
// if the start is before the time slot, we need to set the left to 0
449-
left = 0
450458
}
451459

452460
const timeSpanMin = itemModEnd.diff(itemModStart, "minute")
453461
const width = timeSpanMin / timeSlotMinutes
454462

455-
/*let dmin = itemModEnd.diff(slotsArray[endSlot], "minute")
456-
// because of the time frame of the day, i need to remove the amount if minutes missing to the days end * the amount of days of the time slot to get the correct end
457-
if (viewType !== "hours") {
458-
const daysCount = Math.floor(dmin / (26 * 60))
459-
if (daysCount > 0) {
460-
const diffToDayEnd = itemModEnd.diff(
461-
itemModEnd.endOf("day"),
462-
"minute",
463-
)
464-
dmin -= daysCount * diffToDayEnd
465-
}
466-
}
467-
let width = dmin / timeSteps*/
468-
469-
// check if this is the last time slot of the day
470-
//width = endSlot + 1 - startSlot - (left + width)
471-
//width = endSlot - startSlot + width - left
472-
473463
if (width <= 0) {
474464
// this should not happen, but if it does, we need to log it to find the error
475465
console.error(
476-
"LPTimeTable - item with negative width found:",
466+
"LPTimeTable - item with negative/zero width found:",
477467
width,
478468
item,
479469
startSlot,
@@ -486,6 +476,24 @@ export function getLeftAndWidth(
486476
)
487477
}
488478

479+
/*console.log(
480+
"LEFT",
481+
left,
482+
item,
483+
itemModStart,
484+
slotStart,
485+
timeSlotMinutes,
486+
slotStart,
487+
"DAY STARTDIFF",
488+
dayStartDiff,
489+
"STARTSUM",
490+
startSum,
491+
"TFD",
492+
timeFrameDay,
493+
"SLOTSTARTDIFF",
494+
slotStartDiff,
495+
)*/
496+
489497
return { left, width }
490498
}
491499

0 commit comments

Comments
 (0)