feat: refactor project
This commit is contained in:
@@ -1 +1 @@
|
||||
select count(*) from {elo_schema}.comparisons
|
||||
select count(*) from {{ elo_schema }}.comparisons
|
||||
|
||||
@@ -1 +1 @@
|
||||
select count(*) from {listings_schema}.{listings_table}
|
||||
select count(*) from {{ listings_schema }}.{{ listings_table }}
|
||||
|
||||
@@ -1 +1 @@
|
||||
select count(*) from {elo_schema}.ratings
|
||||
select count(*) from {{ elo_schema }}.ratings
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user