Fix empty stats
This commit is contained in:
parent
b8898451ea
commit
272591b015
|
@ -152,7 +152,7 @@ func (db *DB) FetchMarketOrders(marketId int64, orders *[]Order) error {
|
|||
"CASE WHEN o.order_id IS NOT NULL THEN 'EXECUTED' ELSE 'PENDING' END AS status, o.order_id " +
|
||||
"FROM orders o " +
|
||||
"JOIN shares s ON o.share_id = s.id " +
|
||||
"WHERE s.market_id = $1 AND ( (o.side = 'BUY' AND o.order_id IS NOT NULL) OR o.side = 'SELL' ) " +
|
||||
"WHERE s.market_id = $1 AND ( (o.side = 'BUY') OR o.side = 'SELL' ) " +
|
||||
"ORDER BY o.created_at DESC"
|
||||
rows, err := db.Query(query, marketId)
|
||||
if err != nil {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div class="mt-3">
|
||||
<div class="mb-1">
|
||||
<span>YES: {{ (currentYes * 100).toFixed(2) }}%</span>
|
||||
<span>NO: {{ (currentNo * 100).toFixed(2) }}%</span>
|
||||
<span>YES: {{ typeof currentYes === "string" ? currentYes : (currentYes * 100).toFixed(2) + "%" }}</span>
|
||||
<span>NO: {{ typeof currentNo === "string" ? currentNo : (currentNo * 100).toFixed(2) + "%" }}</span>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<span>Volume: {{ volume }} sats</span>
|
||||
|
@ -50,8 +50,10 @@ let volume = 0
|
|||
const yesData = getFilterData('YES')
|
||||
const noData = getFilterData('NO')
|
||||
|
||||
const currentYes = yesData.at(-1)
|
||||
const currentNo = noData.at(-1)
|
||||
let currentYes = yesData.at(-1)
|
||||
if (!currentYes) currentYes = 'n/a'
|
||||
let currentNo = noData.at(-1)
|
||||
if (!currentNo) currentNo = 'n/a'
|
||||
|
||||
const chartData = {
|
||||
labels: stats.value ? stats.value.map(({ x }) => ago(new Date(x))) : [],
|
||||
|
|
Loading…
Reference in New Issue