-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswipe-precision.sql
More file actions
38 lines (38 loc) · 979 Bytes
/
swipe-precision.sql
File metadata and controls
38 lines (38 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
select variant, avg(num_right_swipes) mean_right_swipes,
10 swipe_threshold, count(t2.user_id) num_users
from
variants t1
inner join
(select user_id,
sum(case when is_right_swipe = TRUE then 1 else 0 end) num_right_swipes
from swipes
group by user_id
having count(id) >= 10) t2
on t1.user_id = t2.user_id
group by variant
union
select variant, avg(num_right_swipes) mean_right_swipes,
50 swipe_threshold, count(t2.user_id) num_users
from
variants t1
inner join
(select user_id,
sum(case when is_right_swipe = TRUE then 1 else 0 end) num_right_swipes
from swipes
group by user_id
having count(id) >= 50) t2
on t1.user_id = t2.user_id
group by variant
union
select variant, avg(num_right_swipes) mean_right_swipes,
100 swipe_threshold, count(t2.user_id) num_users
from
variants t1
inner join
(select user_id,
sum(case when is_right_swipe = TRUE then 1 else 0 end) num_right_swipes
from swipes
group by user_id
having count(id) >= 100) t2
on t1.user_id = t2.user_id
group by variant