Class: WorkerPlugins::QueryLinksStatus

Inherits:
ApplicationService show all
Defined in:
app/services/worker_plugins/query_links_status.rb

Instance Method Summary collapse

Methods inherited from ApplicationService

#db_now_value, #postgres?, #quote, #quote_column, #quote_table, #sqlite?

Instance Method Details

#performObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/worker_plugins/query_links_status.rb', line 4

def perform
  checked_count = workplace
    .workplace_links
    .where(resource_id: query.distinct.select(query.klass.primary_key))
    .count

  query_count = query.count

  succeed!(
    all_checked: query_count == checked_count,
    checked_count:,
    query_count:,
    some_checked: checked_count.positive? && checked_count < query_count
  )
end