feat: refactor project

This commit is contained in:
Stijnvandenbroek
2026-03-06 14:51:26 +00:00
parent c908d96921
commit 535a09fd75
28 changed files with 1136 additions and 51 deletions

View File

@@ -1 +1 @@
select count(*) from {elo_schema}.comparisons
select count(*) from {{ elo_schema }}.comparisons

View File

@@ -1 +1 @@
select count(*) from {listings_schema}.{listings_table}
select count(*) from {{ listings_schema }}.{{ listings_table }}

View File

@@ -1 +1 @@
select count(*) from {elo_schema}.ratings
select count(*) from {{ elo_schema }}.ratings

View File

@@ -1,5 +1,5 @@
select
avg(elo_rating),
max(elo_rating),
min(elo_rating)
from {elo_schema}.ratings
avg(elo_rating) as avg_elo,
max(elo_rating) as max_elo,
min(elo_rating) as min_elo
from {{ elo_schema }}.ratings

View File

@@ -1,6 +1,6 @@
select
floor(elo_rating / 50) * 50 as bucket,
count(*) as count
from {elo_schema}.ratings
from {{ elo_schema }}.ratings
group by bucket
order by bucket

View File

@@ -3,12 +3,12 @@ select
a.title as listing_a_title,
b.title as listing_b_title,
w.title as winner_title
from {elo_schema}.comparisons as c
left join {listings_schema}.{listings_table} as a
from {{ elo_schema }}.comparisons as c
left join {{ listings_schema }}.{{ listings_table }} as a
on c.listing_a_id = a.global_id
left join {listings_schema}.{listings_table} as b
left join {{ listings_schema }}.{{ listings_table }} as b
on c.listing_b_id = b.global_id
left join {listings_schema}.{listings_table} as w
left join {{ listings_schema }}.{{ listings_table }} as w
on c.winner_id = w.global_id
order by c.created_at desc
limit :limit

View File

@@ -1,4 +1,3 @@
select
raw_json -> 'photo_urls' as photo_urls
from {images_schema}.{images_table}
select raw_json -> 'photo_urls' as photo_urls
from {{ images_schema }}.{{ images_table }}
where global_id = :gid

View File

@@ -35,6 +35,6 @@ select
coalesce(r.comparison_count, 0) as comparison_count,
coalesce(r.wins, 0) as wins,
coalesce(r.losses, 0) as losses
from {listings_schema}.{listings_table} as l
left join {elo_schema}.ratings as r
from {{ listings_schema }}.{{ listings_table }} as l
left join {{ elo_schema }}.ratings as r
on l.global_id = r.global_id

View File

@@ -1,6 +1,6 @@
select
listing_a_id,
listing_b_id
from {elo_schema}.comparisons
from {{ elo_schema }}.comparisons
order by created_at desc
limit 20