lib/bidu/house/report/error.rb in bidu-house-0.2.0 vs lib/bidu/house/report/error.rb in bidu-house-0.2.1
- old
+ new
@@ -33,16 +33,21 @@
def scoped
@scoped ||= fetch_scoped(last_entries, scope)
end
def error?
- percentage > threshold
+ @error ||= percentage > threshold
end
+ def status
+ error? ? :error : :ok
+ end
+
def as_json
{
ids: scoped.pluck(external_key),
- percentage: percentage
+ percentage: percentage,
+ status: status
}
end
private