Skip to content

Commit f110a4e

Browse files
committed
📝 Some fixes in Venn
1 parent b6577fd commit f110a4e

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

src/endpoints/venn/venn.ts

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,29 @@ type Output = {
1717

1818
const builder = SQONBuilder;
1919

20-
const setFormulasDuo = (s1: v3SQON, s2: v3SQON) => [
21-
{
22-
operation: 'Q₁',
23-
count: undefined,
24-
sqon: builder.from(s1),
25-
},
26-
{
27-
operation: 'Q₂',
28-
count: undefined,
29-
sqon: builder.from(s2),
30-
},
31-
{
32-
operation: '(Q₁∩Q₂)',
33-
sqon: builder.and([s1, s2]),
34-
},
35-
{
36-
operation: '(Q₁)-(Q₂)',
37-
sqon: builder.from(s1).not(builder.from(s2)),
38-
},
39-
{
40-
operation: '(Q₂)-(Q₁)',
41-
sqon: builder.from(s2).not(builder.from(s1)),
42-
},
43-
];
20+
const setFormulasDuo = (s1: v3SQON, s2: v3SQON) =>
21+
[
22+
{
23+
operation: 'Q₁',
24+
sqon: builder.from(s1),
25+
},
26+
{
27+
operation: 'Q₂',
28+
sqon: builder.from(s2),
29+
},
30+
{
31+
operation: 'Q₁-Q₂',
32+
sqon: builder.from(s1).not(builder.from(s2)),
33+
},
34+
{
35+
operation: 'Q₂-Q₁',
36+
sqon: builder.from(s2).not(builder.from(s1)),
37+
},
38+
{
39+
operation: 'Q₁∩Q₂',
40+
sqon: builder.and([s1, s2]),
41+
},
42+
].map(x => ({ ...x, sqon: renameFieldNameToField(x.sqon) }));
4443

4544
const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
4645
[
@@ -57,8 +56,16 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
5756
sqon: builder.from(s3),
5857
},
5958
{
60-
operation: '(Q₁∩Q₂∩Q₃)',
61-
sqon: builder.and([s1, s2, s3]),
59+
operation: '(Q₁)-(Q₂∩Q₃)',
60+
sqon: builder.from(s1).not(builder.and([s2, s3])),
61+
},
62+
{
63+
operation: '(Q₂)-(Q₁∩Q₃)',
64+
sqon: builder.from(s2).not(builder.and([s1, s3])),
65+
},
66+
{
67+
operation: '(Q₃)-(Q₁∩Q₂)',
68+
sqon: builder.from(s3).not(builder.and([s1, s2])),
6269
},
6370
{
6471
operation: '(Q₁∩Q₂)-(Q₃)',
@@ -73,16 +80,8 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
7380
sqon: builder.and([s1, s3]).not(s2),
7481
},
7582
{
76-
operation: '(Q₁)-(Q₂∩Q₃)',
77-
sqon: builder.from(s1).not(builder.or([s2, s3])),
78-
},
79-
{
80-
operation: '(Q₂)-(Q₁∩Q₃)',
81-
sqon: builder.from(s2).not(builder.or([s1, s3])),
82-
},
83-
{
84-
operation: '(Q₃)-(Q₁∩Q₂)',
85-
sqon: builder.from(s3).not(builder.or([s1, s2])),
83+
operation: '(Q₁∩Q₂∩Q₃)',
84+
sqon: builder.and([s1, s2, s3]),
8685
},
8786
].map(x => ({ ...x, sqon: renameFieldNameToField(x.sqon) }));
8887

0 commit comments

Comments
 (0)