Skip to content

Business intelligence made simple

Added computed_check_type method [skip ci]

Andrew Kane0f70cf543b30
diff --git a/app/models/blazer/check.rb b/app/models/blazer/check.rb
index 2c3d5182..44b9700f 100644
--- a/app/models/blazer/check.rb
+++ b/app/models/blazer/check.rb
@@ -11,14 +11,7 @@ module Blazer
before_validation :fix_emails
def update_state(result)
- check_type =
- if respond_to?(:check_type)
- self.check_type
- elsif respond_to?(:invert)
- invert ? "missing_data" : "bad_data"
- else
- "bad_data"
- end
+ check_type = computed_check_type
message = result.error
@@ -63,6 +56,16 @@ module Blazer
save! if changed?
end
+ def computed_check_type
+ if respond_to?(:check_type)
+ check_type
+ elsif respond_to?(:invert)
+ invert ? "missing_data" : "bad_data"
+ else
+ "bad_data"
+ end
+ end
+
private
def set_state