Commit c90d167b authored by Adam Niedzielski's avatar Adam Niedzielski

Create Member.expired scope.

parent 08ecf0e7
......@@ -31,6 +31,7 @@ class Member < ActiveRecord::Base
scope :non_invite, -> { where(invite_token: nil) }
scope :request, -> { where.not(requested_at: nil) }
scope :has_access, -> { where('access_level > 0') }
scope :expired, -> { where('expires_at <= ?', Time.current) }
scope :guests, -> { where(access_level: GUEST) }
scope :reporters, -> { where(access_level: REPORTER) }
......
......@@ -2,7 +2,7 @@ class RemoveExpiredMembersWorker
include Sidekiq::Worker
def perform
Member.where('expires_at <= ?', Time.current).find_each do |member|
Member.expired.find_each do |member|
begin
Members::AuthorizedDestroyService.new(member).execute
rescue => ex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment