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
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
puts "NOW IN CREATE"
|
|
||||||
params = sign_in_params
|
params = sign_in_params
|
||||||
@user = User.find_by(email: params[:email])
|
@user = User.find_by(email: params[:email])
|
||||||
if @user == nil || !@user.valid_password?(params[:password])
|
if @user == nil || !@user.valid_password?(params[:password])
|
||||||
redirect_to "/signin"
|
redirect_to "/signin"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
super
|
|
||||||
#Do we need this code below? It was never running before
|
|
||||||
resource = warden.authenticate!(:scope => :user)
|
resource = warden.authenticate!(:scope => :user)
|
||||||
sign_in(:user, resource)
|
sign_in(:user, resource)
|
||||||
if !current_user.admin
|
if !current_user.admin
|
||||||
|
|||||||
@ -1,6 +1,14 @@
|
|||||||
class StatisticsController < ApplicationController
|
class StatisticsController < ApplicationController
|
||||||
|
|
||||||
def index
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user