Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Widget utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gbooking
Widget utils
Commits
7b8ac903
Commit
7b8ac903
authored
7 years ago
by
Fadi Karkaby
Browse files
Options
Downloads
Patches
Plain Diff
crac 1= free, 0 busy
parent
b99d4ba5
Branches
Branches containing commit
Tags
0.4.0
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crac.js
+11
-12
11 additions, 12 deletions
src/crac.js
with
11 additions
and
12 deletions
src/crac.js
+
11
−
12
View file @
7b8ac903
...
...
@@ -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
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment