Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cfca5ea

Browse files
authoredMar 9, 2023
Merge pull request #162 from roiLeo/fix/series/floorprice
🔧 series floorprice
2 parents 24a06fb + cf65827 commit cfca5ea

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
 

‎src/mappings/utils/cache.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ enum Query {
2525
COUNT(distinct ne.current_owner) as unique_collectors,
2626
COUNT(distinct ne.current_owner) as sold,
2727
COUNT(ne.*) as total,
28-
AVG(ne.price) as average_price,
29-
MIN(NULLIF(ne.price, 0)) as floor_price,
30-
COALESCE(MAX(e.meta :: bigint), 0) as highest_sale,
28+
AVG(e.meta::bigint) as average_price,
29+
MIN(NULLIF(e.meta::bigint, 0)) as floor_price,
30+
COALESCE(MAX(e.meta::bigint), 0) as highest_sale,
3131
COALESCE(SUM(e.meta::bigint), 0) as volume,
3232
COUNT(e.*) as buys,
3333
0 as emote_count
@@ -36,6 +36,7 @@ enum Query {
3636
LEFT JOIN nft_entity ne on ce.id = ne.collection_id
3737
JOIN event e on ne.id = e.nft_id
3838
WHERE e.interaction = 'BUY'
39+
OR e.interaction = 'LIST'
3940
GROUP BY ce.id, me.image, ce.name
4041
ORDER BY volume DESC
4142
LIMIT 100`,

‎src/server-extension/resolvers/series.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export class SeriesResolver {
5454
COUNT(distinct ne.current_owner) as unique_collectors,
5555
COUNT(distinct ne.current_owner) as sold,
5656
COUNT(ne.*) as total,
57-
AVG(ne.price) as average_price,
58-
MIN(NULLIF(ne.price, 0)) as floor_price,
57+
AVG(e.meta::bigint) as average_price,
58+
MIN(NULLIF(e.meta::bigint, 0)) as floor_price,
5959
COALESCE(MAX(e.meta::bigint), 0) as highest_sale,
6060
COALESCE(SUM(e.meta::bigint), 0) as volume,
6161
COUNT(e.*) as buys
@@ -64,9 +64,10 @@ export class SeriesResolver {
6464
LEFT JOIN nft_entity ne on ce.id = ne.collection_id
6565
JOIN event e on ne.id = e.nft_id
6666
WHERE e.interaction = 'BUY' ${computedDateRange}
67+
OR e.interaction = 'LIST' ${computedDateRange}
6768
GROUP BY ce.id, me.image, ce.name
6869
ORDER BY ${orderBy} ${orderDirection}
69-
LIMIT ${limit} OFFSET ${offset}`;
70+
LIMIT ${limit} OFFSET ${offset}`
7071
const result: SeriesEntity[] = await makeQuery(this.tx, NFTEntity, query);
7172

7273
return result;

0 commit comments

Comments
 (0)
This repository has been archived.