Commit 7e8e3ba

mo khan <mo@mokhan.ca>
2017-02-18 17:38:20
default to 1 month of data.
1 parent 72dcfcd
Changed files (2)
app
app/controllers/workouts_controller.rb
@@ -41,7 +41,7 @@ class WorkoutsController < ApplicationController
     )
   end
 
-  def recent_workouts(exercise, since = (params[:since] || 7.days).to_i.seconds.ago)
+  def recent_workouts(exercise, since = (params[:since] || 1.month).to_i.seconds.ago)
     @since = since.beginning_of_day
     workouts = current_user.workouts.since(since).recent.includes(:routine)
     exercise ? workouts.with_exercise(exercise) : workouts
app/views/workouts/index.html.erb
@@ -19,7 +19,7 @@
                   <%= hidden_field_tag key, value %>
                 <% end %>
                 <span class="select">
-                  <%= select_tag :since, options_for_select(@ranges.map { |x| [time_ago_in_words(x.ago), x.to_i] }, params[:since]) %>
+                  <%= select_tag :since, options_for_select(@ranges.map { |x| [time_ago_in_words(x.ago), x.to_i] }, params[:since]), include_blank: true  %>
                 </span>
               </p>
             <% end %>