Sha256: 59ef498de871cddd17b7895707903e813a46238aa00f055ce7afb877fa24954e

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

module Catarse
class Adm::FinancialsController < Catarse::Adm::BaseController
  inherit_resources
  defaults  resource_class: Project, collection_name: 'projects', instance_name: 'project'
  menu I18n.t("adm.financials.index.menu") => Catarse::Core::Engine.routes.url_helpers.adm_financials_path
  actions :index

  def collection
    @search = end_of_association_chain.
      where("expires_at > current_timestamp - '15 days'::interval").
      where("state in ('online', 'successful', 'waiting_funds')").includes(:project_total, :user).search(params[:search])
    @projects = @search.order("CASE state WHEN 'successful' THEN 1 WHEN 'waiting_funds' THEN 2 ELSE 3 END, expires_at::date").page(params[:page])
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_core-1.0.0.beta app/controllers/catarse/adm/financials_controller.rb