Sha256: cd531452d7086d2a44fd8045cb9621990186ab203c4b52e3c17fd57888a724b7
Contents?: true
Size: 1.22 KB
Versions: 6
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Quby module Answers module Entities class Outcome # @return [Hash] attr_writer :scores # @return [Hash] attr_writer :actions # @return [Hash] attr_accessor :completion # @return [Time] attr_accessor :generated_at def initialize(scores: {}, actions: {}, completion: {}, generated_at: nil) self.scores = scores self.actions = actions self.completion = completion self.generated_at = generated_at end def scores @scores.with_indifferent_access end def actions @actions.with_indifferent_access end def action alarm_scores = scores.select { |key, value| value["status"].to_s == "alarm" } alarm_answers = actions[:alarm] || [] attention_scores = scores.select { |key, value| value["status"].to_s == "attention" } attention_answers = actions[:attention] || [] return :alarm if alarm_scores.any? || alarm_answers.any? return :attention if attention_scores.any? || attention_answers.any? nil end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems