Skip to content
Snippets Groups Projects
Commit 7b8ac903 authored by Fadi Karkaby's avatar Fadi Karkaby
Browse files

crac 1= free, 0 busy

parent b99d4ba5
Branches
Tags 0.4.0
No related merge requests found
......@@ -151,10 +151,14 @@ function getCrunchSlotsFromCrac(cracSlot, date, startMinutes, endMinutes, maxSlo
// console.log('--> ', ii, bit, minutes);
if (bit === 1) {
available = true;
if (currentSlot) {
commitSlot();
}
} else if (bit === 0) {
if (!currentSlot){
// console.info('switched to `1` bit', minutes);
makeSlot(minutes);
// console.log('currentSlot.duration:', currentSlot && currentSlot.duration);
} else{
currentSlot.duration += SLOT_SIZE;
// console.log('currentSlot.duration:', currentSlot && currentSlot.duration);
......@@ -165,12 +169,7 @@ function getCrunchSlotsFromCrac(cracSlot, date, startMinutes, endMinutes, maxSlo
makeSlot(minutes);
}
}
} else if (bit === 0) {
available = true;
if (currentSlot) {
// console.info('switched to `0` bit', minutes);
commitSlot();
}
}
}
......@@ -182,7 +181,7 @@ function getCrunchSlotsFromCrac(cracSlot, date, startMinutes, endMinutes, maxSlo
const busySlotsLength = busySlots.length;
// Change start_time bounds according to near available time.
if (bitmask[reverseOffset - startBitIndex] === 1) {
if (bitmask[reverseOffset - startBitIndex] === 0) {
let startSlot = busySlots[0];
for (let ii = 1; ii < busySlotsLength; ii++) {
let slot = busySlots[ii];
......@@ -202,7 +201,7 @@ function getCrunchSlotsFromCrac(cracSlot, date, startMinutes, endMinutes, maxSlo
}
// Change end_time bounds according to near available time.
if (bitmask[reverseOffset - endBitIndex + 1] === 1) {
if (bitmask[reverseOffset - endBitIndex + 1] === 0) {
let endSlot = busySlots[busySlotsLength - 1];
for (let ii = busySlotsLength - 2; ii >= 0; ii--) {
let slot = busySlots[ii];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment