Compare commits

...

2 Commits

Author SHA1 Message Date
2bdf74e57e Use text-reset if p=0.5 2024-09-11 12:59:45 +02:00
48bd8bc2b0 Fix new markets not shown 2024-09-11 12:51:07 +02:00
2 changed files with 7 additions and 4 deletions

View File

@ -33,12 +33,12 @@ func HandleIndex(sc context.Context) echo.HandlerFunc {
" GROUP BY o.market_id"+ " GROUP BY o.market_id"+
")"+ ")"+
"SELECT m.id, m.question, m.description, m.created_at, m.end_date, "+ "SELECT m.id, m.question, m.description, m.created_at, m.end_date, "+
"m.lmsr_b, l.q1, l.q2, l.volume, "+ "m.lmsr_b, COALESCE(l.q1, 0), COALESCE(l.q2, 0), COALESCE(l.volume, 0), "+
"u.id, u.name, u.created_at, u.ln_pubkey, u.nostr_pubkey, u.msats "+ "u.id, u.name, u.created_at, u.ln_pubkey, u.nostr_pubkey, u.msats "+
"FROM markets m "+ "FROM markets m "+
"JOIN users u ON m.user_id = u.id "+ "JOIN users u ON m.user_id = u.id "+
"JOIN invoices i ON m.invoice_id = i.id "+ "JOIN invoices i ON m.invoice_id = i.id "+
"JOIN lmsr l ON m.id = l.market_id "+ "LEFT JOIN lmsr l ON m.id = l.market_id "+
"WHERE i.confirmed_at IS NOT NULL"); err != nil { "WHERE i.confirmed_at IS NOT NULL"); err != nil {
return err return err
} }

View File

@ -103,12 +103,15 @@ func humanizeRound(f float64) string {
} }
func colorize(f float64) string { func colorize(f float64) string {
if f > 0.5 { eps := 1e-5
if f-0.5 > eps {
return "text-success" return "text-success"
} else { } else if 0.5-f > eps {
return "text-error" return "text-error"
} }
return "text-reset"
} }
func tabStyle(path string, tab string) string { func tabStyle(path string, tab string) string {