Improve readability

This commit is contained in:
Artur Beljajev 2019-09-17 18:03:49 +03:00 committed by Alex Sherman
parent 9eb7d3527b
commit cbb3c0d5ef
3 changed files with 8 additions and 8 deletions

View file

@ -6,14 +6,14 @@ class EppSession < ApplicationRecord
class_attribute :timeout
self.timeout = (ENV['epp_session_timeout_seconds'] || 300).to_i.seconds
class_attribute :limit_per_registrar
self.limit_per_registrar = (ENV['epp_session_limit_per_registrar'] || 4).to_i
class_attribute :sessions_per_registrar
self.sessions_per_registrar = (ENV['epp_session_limit_per_registrar'] || 4).to_i
alias_attribute :last_access, :updated_at
def self.limit_reached?(registrar)
count = where(user_id: registrar.api_users.ids).count
count >= limit_per_registrar
count >= sessions_per_registrar
end
def self.expired