pmng/src/pmng/functions/statistics.cr

34 lines
613 B
Crystal

module Pmng::Functions
extend self
class Statistics
getter passwords : Array(Password)
getter outdated : Int32
getter size : Int32
def initialize(@passwords)
@size = passwords.size
outdated_count = 0
current_time = Time.local.to_unix
a = [] of String
@passwords.each do |item|
if item.update + (2629743 * 3) < current_time # 2629743 * 3 -- 3 month
outdated_count += 1
a << item.url
end
end
@outdated = outdated_count
end
def size
@size
end
def outdated
@outdated
end
end
end