From 66ee13a52d6dd8caf0c8593ff40a30eee4ae1ed9 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 23 Nov 2020 19:25:11 +0000 Subject: [PATCH] Ensure boolean expressions return actual value not boolean value --- db/fetch.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/db/fetch.go b/db/fetch.go index db729369..260b6ee1 100644 --- a/db/fetch.go +++ b/db/fetch.go @@ -525,14 +525,19 @@ func calcAsMath(i interface{}) float64 { func binaryBool(op sql.Token, l, r interface{}) interface{} { - a := calcAsBool(l) - b := calcAsBool(r) - switch op { case sql.AND: - return a && b + if calcAsBool(l) && calcAsBool(r) { + return l + } else { + return r + } case sql.OR: - return a || b + if calcAsBool(l) { + return l + } else { + return r + } } return nil