Sha256: c453bdb376ff0338c9659b645a3eb1c19a5fb5e0e1db7960cbaeedea04cfbc0b

Contents?: true

Size: 539 Bytes

Versions: 36

Compression:

Stored size: 539 Bytes

Contents

require 'chronic_duration'

module Perus::Server
    class ActiveAlert < Sequel::Model
        many_to_one :alert
        many_to_one :system

        def severity
            alert.severity
        end

        def active_for
            ChronicDuration.output(Time.now.to_i - timestamp, format: :short)
        end

        def self.add(alert, system)
            ActiveAlert.create(
                system_id: system.id,
                alert_id: alert.id,
                timestamp: Time.now.to_i
            )
        end
    end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
perus-1.0.7 lib/perus/server/models/active_alert.rb
perus-1.0.6 lib/perus/server/models/active_alert.rb
perus-1.0.5 lib/perus/server/models/active_alert.rb
perus-1.0.4 lib/perus/server/models/active_alert.rb
perus-1.0.3 lib/perus/server/models/active_alert.rb
perus-1.0.2 lib/perus/server/models/active_alert.rb
perus-1.0.1 lib/perus/server/models/active_alert.rb
perus-1.0.0 lib/perus/server/models/active_alert.rb
perus-0.1.35 lib/perus/server/models/active_alert.rb
perus-0.1.34 lib/perus/server/models/active_alert.rb
perus-0.1.33 lib/perus/server/models/active_alert.rb
perus-0.1.32 lib/perus/server/models/active_alert.rb
perus-0.1.31 lib/perus/server/models/active_alert.rb
perus-0.1.30 lib/perus/server/models/active_alert.rb
perus-0.1.29 lib/perus/server/models/active_alert.rb
perus-0.1.28 lib/perus/server/models/active_alert.rb
perus-0.1.27 lib/perus/server/models/active_alert.rb
perus-0.1.26 lib/perus/server/models/active_alert.rb
perus-0.1.25 lib/perus/server/models/active_alert.rb
perus-0.1.24 lib/perus/server/models/active_alert.rb