Sha256: c94a82aaec16f82b45814d1b82cf860b5824059fb24a5070152945669b7ddfcc

Contents?: true

Size: 931 Bytes

Versions: 35

Compression:

Stored size: 931 Bytes

Contents

module Workarea
  module Search
    class Admin
      module Releasable
        def facets
          super.merge(upcoming_changes: upcoming_release_ids_with_changesets)
        end

        def status
          if model.active?
            'active'
          else
            'inactive'
          end
        end

        private

        def upcoming_release_ids_with_changesets
          (model_changesets + content_changesets).map(&:release_id)
        end

        def model_changesets
          model.changesets.any_in(release_id: upcoming_release_ids)
        end

        def content_changesets
          return [] unless model.is_a?(Contentable)

          Workarea::Content.for(model)
            .changesets
            .any_in(release_id: upcoming_release_ids)
        end

        def upcoming_release_ids
          @upcoming_release_ids ||= Workarea::Release.upcoming.map(&:id)
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
workarea-core-3.4.45 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.44 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.43 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.42 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.41 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.40 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.39 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.38 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.37 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.36 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.35 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.34 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.33 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.32 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.31 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.30 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.29 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.28 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.27 app/models/workarea/search/admin/releasable.rb
workarea-core-3.4.26 app/models/workarea/search/admin/releasable.rb