From 197add9d88deef4540f604f15503d62ae2551a84 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Tue, 7 Mar 2017 23:09:46 +0000 Subject: [PATCH] Refactor sumo_internal:get_id_field `lists:member` is [documented as working on matching](https://github.com/erlang/otp/blob/OTP-19.2.3/lib/stdlib/doc/src/lists.xml#L530), and I tested that integer does not match to float and viceversa (float does not match to integer). (I tested integer and float as the deleted code was using `=:=` as opposed to `==`). --- src/sumo_internal.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sumo_internal.erl b/src/sumo_internal.erl index d906eaf..105ca65 100644 --- a/src/sumo_internal.erl +++ b/src/sumo_internal.erl @@ -200,5 +200,5 @@ report_overrun(Report) -> %% @private get_id_field(_Schema = #{fields := Fields}) -> hd(lists:filter(fun(_Field = #{attrs := Attributes}) -> - length(lists:filter(fun(T) -> T =:= id end, Attributes)) > 0 + lists:member(id, Attributes) end, Fields)).