diff --git a/Gemfile b/Gemfile index 7a3daa0..76f5947 100644 --- a/Gemfile +++ b/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' @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 001ca59..456f9c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -236,3 +235,6 @@ DEPENDENCIES turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) + +BUNDLED WITH + 1.16.1 diff --git a/app/controllers/event_log_files_controller.rb b/app/controllers/event_log_files_controller.rb index c4c9f48..a6cd362 100644 --- a/app/controllers/event_log_files_controller.rb +++ b/app/controllers/event_log_files_controller.rb @@ -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.") @@ -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. diff --git a/app/views/event_log_files/index.html.haml b/app/views/event_log_files/index.html.haml index fa83a71..33fbdd7 100644 --- a/app/views/event_log_files/index.html.haml +++ b/app/views/event_log_files/index.html.haml @@ -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")