From 0bf4d5218326373cdafb195ae3c08235419f76fd Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Fri, 24 Feb 2023 11:41:54 +0900 Subject: [PATCH] Return zeroed out `fee_amt_percentiles` if there is no transaction --- .../src/repositories/BlocksSummariesRepository.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/repositories/BlocksSummariesRepository.ts b/backend/src/repositories/BlocksSummariesRepository.ts index ebc83b7dd..2724ddcf5 100644 --- a/backend/src/repositories/BlocksSummariesRepository.ts +++ b/backend/src/repositories/BlocksSummariesRepository.ts @@ -108,13 +108,13 @@ class BlocksSummariesRepository { const fees = transactions.map((t: any) => t.fee); return [ - fees[0], // min - fees[Math.max(0, Math.floor(fees.length * 0.1) - 1)], // 10th - fees[Math.max(0, Math.floor(fees.length * 0.25) - 1)], // 25th - fees[Math.max(0, Math.floor(fees.length * 0.5) - 1)], // median - fees[Math.max(0, Math.floor(fees.length * 0.75) - 1)], // 75th - fees[Math.max(0, Math.floor(fees.length * 0.9) - 1)], // 90th - fees[fees.length - 1], // max + fees[0] ?? 0, // min + fees[Math.max(0, Math.floor(fees.length * 0.1) - 1)] ?? 0, // 10th + fees[Math.max(0, Math.floor(fees.length * 0.25) - 1)] ?? 0, // 25th + fees[Math.max(0, Math.floor(fees.length * 0.5) - 1)] ?? 0, // median + fees[Math.max(0, Math.floor(fees.length * 0.75) - 1)] ?? 0, // 75th + fees[Math.max(0, Math.floor(fees.length * 0.9) - 1)] ?? 0, // 90th + fees[fees.length - 1] ?? 0, // max ]; } catch (e) {