Sha256: d961e0e13c9626867fef914adcd9fbffb83ec1d90916d61df3d4c4cbc9dc12bf

Contents?: true

Size: 876 Bytes

Versions: 53

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Class uses to retrieve initiatives that have been a long time in
    # validating state
    class OutdatedValidatingInitiatives < Rectify::Query
      # Syntactic sugar to initialize the class and return the queried objects.
      #
      # period_length - Maximum time in validating state
      def self.for(period_length)
        new(period_length).query
      end

      # Initializes the class.
      #
      # period_length - Maximum time in validating state
      def initialize(period_length)
        @period_length = Time.current - period_length
      end

      # Retrieves the available initiative types for the given organization.
      def query
        Decidim::Initiative
          .where(state: "validating")
          .where("updated_at < ?", @period_length)
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
decidim-initiatives-0.26.10 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.9 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.8 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.7 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.5 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.0 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.0.rc2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.26.0.rc1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.0 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.0.rc4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.0.rc3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.0.rc2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.25.0.rc1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.24.3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb