Sha256: 43dec0864c4a7a2185bf8487204b41c83746bf4dfb5df2f66b29f8a7b14a27f4

Contents?: true

Size: 336 Bytes

Versions: 19

Compression:

Stored size: 336 Bytes

Contents

module EgovUtils
  class ArchiveUsers
    def call
      EgovUtils::User
        .where.not(days_before_archive: nil, active: true).each do |user|
        date_to_compare = user.last_login_at || user.created_at
        next if date_to_compare > Time.now - user.days_before_archive.days

        user.destroy
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha15 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha14 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha13 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha12 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha11 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha10 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha9 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha8 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha7 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha6 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha5 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha4 app/services/egov_utils/archive_users.rb
egov_utils-1.4.5 app/services/egov_utils/archive_users.rb
egov_utils-1.4.4 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha3 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha2 app/services/egov_utils/archive_users.rb
egov_utils-1.5.0.alpha1 app/services/egov_utils/archive_users.rb
egov_utils-1.4.3 app/services/egov_utils/archive_users.rb