Skip to content

Commit

Permalink
fix: adapt recommendation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Aug 19, 2020
1 parent 44fbcce commit 9e64fc5
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions lib/src/recommend.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,29 @@ 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
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
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 11/12/13/14
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
union(
intersection(t123, difference(xor(...p3), union(...p12))),
difference(t123, union(...pAll)),
),
), // Level 15/16/17
intersection(today4, ...p4), // Level 18 (attention)
isFuture(difference(xor(...p4), ...today4)), // Level 19 (attention)
);
}

Expand Down

0 comments on commit 9e64fc5

Please sign in to comment.