Skip to content

Commit

Permalink
fix: add new case to baumartenlogic
Browse files Browse the repository at this point in the history
  • Loading branch information
helvetier committed Aug 3, 2020
1 parent 06d2a40 commit 8ba2213
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions lib/src/recommend.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,31 @@ function recommend(location = {}, projections = [], future = false) {
const isMulti = (x) => (projections.length > 1 ? x : []);

return removeDuplicates(
intersection(t123, intersection(...p12)), // Level 1
isMulti(intersection(t123, intersection(xor(...p12),xor(...p3)))), // Level 2/3 -> 2
isFuture(difference(intersection(...p12), t123)), // Level 4 -> 3
isFuture(isMulti(difference(intersection(xor(...p12),xor(...p3)), t123))), // Level 5/6 -> 4
intersection(t123, intersection(...p3)), // Level 7 -> 5
isMulti(intersection(t123, difference(xor(...p12),xor(...p3)))), // Level 8/9 -> 6
isFuture(difference(intersection(...p3), t123)), // Level 10 -> 7
isFuture(isMulti(difference(difference(xor(...p3),union(...p12)),t123))), // Level 11/12 -> 8
isMulti(union(intersection(t123, difference(xor(...p3),union(...p12)))),difference(t123, union(...pAll))), // Level 13/14/15
intersection(today4, ...p4), // Level 16 -> 10
isFuture(difference(xor(...p4), ...today4)), // Level 17 -> 11
intersection(t123, intersection(...p12)), // Level 1
isMulti(intersection(
t123, intersection(xor(...p12),xor(...p3))
)), // Level 2/3
isFuture(difference(intersection(...p12), t123)), // Level 4
isFuture(isMulti(difference(
intersection(xor(...p12),xor(...p3)), t123
))), // Level 5/6
intersection(t123, intersection(...p3)), // Level 7
isMulti(intersection(
t123, difference(xor(...p12),xor(...p3))
)), // Level 8/9
isFuture(difference(intersection(...p3), t123)), // Level 10
isFuture(isMulti(union(
difference(difference(xor(...p12),union(...p3)),t123),
difference(difference(xor(...p3),union(...p12)),t123)
))), // Level 16/17/11/12
isMulti(
union(intersection(
t123, difference(xor(...p3),union(...p12))
)),
difference(t123, union(...pAll))
), // Level 13/14/15
intersection(today4, ...p4), // Level 16
isFuture(difference(xor(...p4), ...today4)), // Level 17
);
}

Expand Down

0 comments on commit 8ba2213

Please sign in to comment.