Skip to content
Permalink
Browse files
get_statistics_subset should return well-formatted null results
The existing code for handling lists of values that don't meet minimum
length causes problems when the `percentiles` key is used; e.g., rather
than the expected

    [{percentile, [{0.5, 0.0}, ... ]}]

the user is presented with

    [{{percentile, [0.5, ... ]}, 0.0}]

which doesn't match the formatting for other subset key. This patch
special-cases the `percentile` key to return the expected result.
  • Loading branch information
b20n committed Nov 17, 2013
1 parent 7d1ee8e commit 1a902e8c37f5f894a6b3203ee8a0279ff543eb82
Showing 1 changed file with 8 additions and 1 deletion.
@@ -114,7 +114,14 @@ get_statistics_subset([_,_,_,_,_|_] = Values, Items) ->
SortedValues, Scan_res, Scan_res2)
end;
get_statistics_subset(Values, Items) when is_list(Values) ->
[{Item, 0.0} || Item <- Items].
get_null_statistics_subset(Items, []).

get_null_statistics_subset([{percentile, Ps}|Items], Acc) ->
get_null_statistics_subset(Items, [{percentile, [{P, 0.0} || P <- Ps]}|Acc]);
get_null_statistics_subset([I|Items], Acc) ->
get_null_statistics_subset(Items, [{I, 0.0}|Acc]);
get_null_statistics_subset([], Acc) ->
lists:reverse(Acc).

calc_steps(Items) ->
lists:foldl(fun({I,_},Acc) ->

0 comments on commit 1a902e8

Please sign in to comment.