27 lines
580 B
Ruby
27 lines
580 B
Ruby
class Transactions::SurveysController < ApplicationController
|
|
def index
|
|
|
|
filter = params[:filter]
|
|
from = params[:from]
|
|
to = params[:to]
|
|
|
|
if filter.nil? && from.nil? && to.nil?
|
|
@surveys = Survey.all
|
|
else
|
|
from = Time.zone.parse(params[:from]).beginning_of_day
|
|
to = Time.zone.parse(params[:to]).end_of_day
|
|
@surveys = Survey.search(filter,from,to)
|
|
end
|
|
|
|
@filter = filter
|
|
@from = from
|
|
@to = to
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
format.xls
|
|
format.json { render json: @surveys }
|
|
end
|
|
end
|
|
end
|