3
0

Check types before converting numerics in CRM report builder

This commit is contained in:
Denis Arh
2019-02-14 06:14:41 +01:00
parent a0e41d1b92
commit f0d21263e6
+5 -2
View File
@@ -164,8 +164,11 @@ func (b recordReportBuilder) Cast(row sqlx.ColScanner) map[string]interface{} {
}
// Cast all metrics to float64
for _, numeric := range b.numerics {
out[numeric], _ = strconv.ParseFloat(out[numeric].(string), 64)
for _, fname := range b.numerics {
switch num := out[fname].(type) {
case string:
out[fname], _ = strconv.ParseFloat(num, 64)
}
}
return out