From 6164f6f55ea1f0e27361f31a386f0ad2f00d8eb1 Mon Sep 17 00:00:00 2001 From: Sven Meinhardt <64724913+s-meinhardt@users.noreply.github.com> Date: Sat, 13 Aug 2022 08:16:54 +0100 Subject: [PATCH 1/2] Update result.rb [This PR](https://github.com/github/scientist/pull/77) of the scientist gem from Oct 2021 changed the interface of the `equivalent_to?` method which no longer transforms an optional block into the `comparator` proc. Instead, one has to pass the comparator directly as a proc. Without that change, the `comparator` variable of `equivalent_to` keeps its default value `nil` which leads to incorrect comparisons, e.g. `Result.equivalent = false` even though `experiment.comparator` returns `true`. --- app/models/lab_tech/result.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/lab_tech/result.rb b/app/models/lab_tech/result.rb index 1696a10..4b0ef7d 100644 --- a/app/models/lab_tech/result.rb +++ b/app/models/lab_tech/result.rb @@ -115,7 +115,7 @@ def record_observation(scientist_observation, attrs = {}) def record_simple_stats(scientist_result) cont, cands = scientist_result.control, scientist_result.candidates - self.equivalent = cands.all? { |cand| cont.equivalent_to?(cand, &experiment.comparator) } + self.equivalent = cands.all? { |cand| cont.equivalent_to?(cand, comparator=experiment.comparator) } raised = ->(scientist_observation) { scientist_observation.exception.present? } self.raised_error = !raised.(cont) && cands.any?(&raised) From be41cb4d9b324598cfa5db2931f9fa95fd1823fb Mon Sep 17 00:00:00 2001 From: Sven Meinhardt <64724913+s-meinhardt@users.noreply.github.com> Date: Sat, 13 Aug 2022 08:24:28 +0100 Subject: [PATCH 2/2] Update result.rb --- app/models/lab_tech/result.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/lab_tech/result.rb b/app/models/lab_tech/result.rb index 4b0ef7d..9a258ea 100644 --- a/app/models/lab_tech/result.rb +++ b/app/models/lab_tech/result.rb @@ -115,7 +115,7 @@ def record_observation(scientist_observation, attrs = {}) def record_simple_stats(scientist_result) cont, cands = scientist_result.control, scientist_result.candidates - self.equivalent = cands.all? { |cand| cont.equivalent_to?(cand, comparator=experiment.comparator) } + self.equivalent = cands.all? { |cand| cont.equivalent_to?(cand, comparator = experiment.comparator) } raised = ->(scientist_observation) { scientist_observation.exception.present? } self.raised_error = !raised.(cont) && cands.any?(&raised)