Skip to content

Commit 8ef190b

Browse files
author
ThatBen
committed
Fixes incorrect float formatting in metricsquery.
1 parent 9461968 commit 8ef190b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ProjectPlugins/MetricsPlugin/MetricsQuery.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private MetricsSetValue[] MapMultipleValues(object[][] values)
123123
{
124124
if (values != null && values.Length > 0)
125125
{
126-
return values.Select(v => MapValue(v)).ToArray();
126+
return values.Select(MapValue).ToArray();
127127
}
128128
return Array.Empty<MetricsSetValue>();
129129
}
@@ -156,7 +156,14 @@ private string GetQueryTimeRange()
156156

157157
private double ToValue(object v)
158158
{
159-
return Convert.ToDouble(v, CultureInfo.InvariantCulture);
159+
try
160+
{
161+
return Convert.ToDouble(v, CultureInfo.InvariantCulture);
162+
}
163+
catch
164+
{
165+
return double.NaN;
166+
}
160167
}
161168

162169
private DateTime ToTimestamp(object v)
@@ -215,7 +222,7 @@ public string AsCsv()
215222
{
216223
var value = set.Values.SingleOrDefault(v => v.Timestamp == ts);
217224
if (value == null) e.Add(" ");
218-
else e.Add(value.Value.ToString());
225+
else e.Add(value.Value.ToString(CultureInfo.InvariantCulture));
219226
}
220227
});
221228
}

0 commit comments

Comments
 (0)