View difference between Paste ID: 0YPj8KTs and hWvNgsfB
SHOW: | | - or go back to the newest paste.
1-
// Hide all premium questions in https://platform.stratascratch.com/coding?questionType=2
1+
-- https://platform.stratascratch.com/coding/10285-acceptance-rate-by-date
2-
// confirmed to work on April 5 2022
2+
3-
// run in browser console
3+
with sent as (
4-
var all_locks = document.querySelectorAll('i.fa.fa-lock[style="color: gold;"]');
4+
    select
5-
all_locks.forEach(function(el){ el.parentNode.parentNode.parentNode.parentNode.remove(); });
5+
        date as datesent,
6
        user_id_sender||user_id_receiver as requestid
7
    from fb_friend_requests
8
    where action='sent'
9
    order by 1 asc),
10
11
accepted as (
12
    select
13
        date as dateaccepted,
14
        user_id_sender||user_id_receiver as requestid
15
    from fb_friend_requests
16
    where action='accepted'
17
    order by 1 asc
18
)
19
20
select datesent as date,
21
        count(dateaccepted)::FLOAT / count(datesent)::FLOAT as percentage_acceptance
22
from sent s
23
left join accepted a
24
on s.requestid = a.requestid
25
group by 1
26
order by 1 asc
27
28