Sha256: bc64a944341e23bf5c179083b5ef4e87a759c49eb790eab32eca6d5b54e9f23d

Contents?: true

Size: 740 Bytes

Versions: 24

Compression:

Stored size: 740 Bytes

Contents

module Concerns
  module FestivitySqlBuilder

    extend ActiveSupport::Concern

    included do

      def self.advance_by(filter_type)
        advance_by_hash = {minutes: 59}
        advance_by_hash[:hours] = 23 if filter_type == "date"
        advance_by_hash
      end

      def self.parse_categories(category_ids)
        grouped_ids = FestivityCategory.find(category_ids).group_by {|category| category.festivity_category_type}
        category_clauses = grouped_ids.map do |categories|
          "page_id IN (SELECT page_id FROM festivity_page_categories WHERE festivity_category_id IN (#{categories[1].map {|category| category.id}.join(",")}))"
        end
        "(#{category_clauses.join(" AND ")})"

      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.6.2 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.6.1 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.6 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.19 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.18 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.17 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.16 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.15 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.14 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.13 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.12 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.11 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.10 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.9 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.8 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.7 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.6 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.5 app/controllers/concerns/festivity_sql_builder.rb
trusty-festivity-extension-2.5.4 app/controllers/concerns/festivity_sql_builder.rb