mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Started on date filtering for stats
This commit is contained in:
parent
0ffa44897a
commit
8e2d357c3d
@ -6,15 +6,12 @@ class SessionsController < Devise::RegistrationsController
|
||||
end
|
||||
|
||||
def create
|
||||
puts "NOW IN CREATE"
|
||||
params = sign_in_params
|
||||
@user = User.find_by(email: params[:email])
|
||||
if @user == nil || !@user.valid_password?(params[:password])
|
||||
redirect_to "/signin"
|
||||
return
|
||||
end
|
||||
super
|
||||
#Do we need this code below? It was never running before
|
||||
resource = warden.authenticate!(:scope => :user)
|
||||
sign_in(:user, resource)
|
||||
if !current_user.admin
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
class StatisticsController < ApplicationController
|
||||
|
||||
def index
|
||||
puts params.inspect
|
||||
if params[:from_date] != nil && params[:to_date] != nil
|
||||
from_date = Date.parse params[:from_date]
|
||||
to_date = Date.parse params[:to_date]
|
||||
runs = Run.where(:runDate => from_date.beginning_of_day..to_date.end_of_day)
|
||||
puts runs.inspect
|
||||
else
|
||||
runs = Run.all
|
||||
puts runs.inspect
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user