Sha256: b2517ce246deb593f8d8d213ae8345c997713f4813ff6375e7e2bbdfd460e0d6

Contents?: true

Size: 876 Bytes

Versions: 25

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 < Decidim::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

25 entries across 25 versions & 1 rubygems

Version Path
decidim-initiatives-0.29.1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.9 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.29.0 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.8 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.29.0.rc4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.29.0.rc3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.29.0.rc2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.29.0.rc1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.2 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.7 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.1 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.6 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.0 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.5 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.0.rc5 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.28.0.rc4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.4 app/queries/decidim/initiatives/outdated_validating_initiatives.rb
decidim-initiatives-0.27.3 app/queries/decidim/initiatives/outdated_validating_initiatives.rb