Skip to content

Commit

Permalink
removed ruby version, updated puma to v3.11, added in support for int…
Browse files Browse the repository at this point in the history
…erval filtering
  • Loading branch information
iweiss-crm committed Mar 12, 2018
1 parent f4240cc commit cb25a50
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Gemfile
@@ -1,5 +1,4 @@
source 'https://rubygems.org'
ruby "2.3.6"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
Expand Down Expand Up @@ -34,7 +33,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# gem 'bcrypt', '~> 3.1.7'

# Use Puma as the app server
gem 'puma'
gem 'puma', '3.11.3'

# 3rd Party Services
gem 'omniauth-salesforce'
Expand Down
8 changes: 5 additions & 3 deletions Gemfile.lock
Expand Up @@ -125,8 +125,7 @@ GEM
omniauth-salesforce (1.0.5)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
puma (2.11.1)
rack (>= 1.1, < 2.0)
puma (3.11.3)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -227,7 +226,7 @@ DEPENDENCIES
jquery-rails
momentjs-rails
omniauth-salesforce
puma
puma (= 3.11.3)
rails (= 4.2.0)
rspec-rails (~> 3.0)
sass-rails (~> 5.0)
Expand All @@ -236,3 +235,6 @@ DEPENDENCIES
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.16.1
19 changes: 16 additions & 3 deletions app/controllers/event_log_files_controller.rb
Expand Up @@ -28,6 +28,12 @@ def index
end

@event_type = @event_types.find { |event_type| event_type.downcase == params[:eventtype].downcase }

if params[:interval].nil?
@interval = "all"
else
@interval = params[:interval]
end

if @event_type.nil?
flash_message(:warnings, "The 'eventtype' query parameter with value '#{params[:eventtype]}' is invalid. Displaying all event types.")
Expand Down Expand Up @@ -57,14 +63,21 @@ def index
end

where_clause_addition = if @has_one_hr_elf
"AND (Interval = 'Hourly' OR Interval = 'Daily') "
case @interval
when "daily"
"AND Interval = 'Daily' "
when "hourly"
"AND Interval = 'Hourly' "
else
"AND (Interval = 'Hourly' OR Interval = 'Daily') "
end
else
""
end
if @event_type == ALL_EVENTS_TYPE
@log_files = @client.query("#{select_clause} FROM EventLogFile WHERE LogDate >= #{date_to_time(@start_date)} AND LogDate <= #{date_to_time(@end_date)} #{where_clause_addition}#{order_by_clause}")
@log_files = @client.query("#{select_clause} FROM EventLogFile WHERE LogDate >= #{date_to_time(@start_date)} AND LogDate < #{date_to_time(@end_date + 1)} #{where_clause_addition}#{order_by_clause}")
else
@log_files = @client.query("#{select_clause} FROM EventLogFile WHERE LogDate >= #{date_to_time(@start_date)} AND LogDate <= #{date_to_time(@end_date)} AND EventType = '#{@event_type}' #{where_clause_addition}#{order_by_clause}")
@log_files = @client.query("#{select_clause} FROM EventLogFile WHERE LogDate >= #{date_to_time(@start_date)} AND LogDate < #{date_to_time(@end_date + 1)} AND EventType = '#{@event_type}' #{where_clause_addition}#{order_by_clause}")
end
rescue Databasedotcom::SalesForceError => e
# Session has expired. Force user logout.
Expand Down
7 changes: 7 additions & 0 deletions app/views/event_log_files/index.html.haml
Expand Up @@ -9,6 +9,13 @@
%label
Event Type
= select_tag('eventtype', options_for_select(@event_types, @event_type), class: 'form-control')

- if @has_one_hr_elf
.form-group
%label
Interval
= select_tag('interval', options_for_select([['All', 'all'], ['Daily', 'daily'], ['Hourly', 'hourly']], @interval), class: 'form-control')

%button.btn.btn-primary{type: 'submit'}
Apply
= link_to('Clear', event_log_files_path, class: "btn btn-default")
Expand Down

0 comments on commit cb25a50

Please sign in to comment.