mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
feat: trim ipv6 to /48 subnets in duplication detection for stats
This commit is contained in:
parent
cd823837ef
commit
e0d6c4dd5c
@ -34,7 +34,11 @@ public interface HangarStatsDAO {
|
||||
SELECT sq.day,
|
||||
sq.project_id,
|
||||
<if(downloads)>sq.version_id, sq.platform,<endif>
|
||||
count(DISTINCT sq.<if(withUserId)>user_id<else>address<endif>) FILTER (WHERE sq.processed \\<@ ARRAY[1])
|
||||
<if(withUserId)>count(DISTINCT sq.user_id)<else>count(distinct network(case
|
||||
when family(sq.address::inet) = 6 then set_masklen(sq.address, 48)
|
||||
when family(sq.address::inet) = 4 then set_masklen(sq.address, 32)
|
||||
else null end
|
||||
)::inet)<endif> FILTER (WHERE sq.processed \\<@ ARRAY[1])
|
||||
FROM (SELECT date_trunc('DAY', d.created_at)::date AS day,
|
||||
d.project_id,
|
||||
<if(downloads)>d.version_id, d.platform,<endif>
|
||||
|
Loading…
Reference in New Issue
Block a user