diff --git a/.gitignore b/.gitignore index abced15..aea16bd 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ !/app/assets/builds/.keep .irb_history + +.DS_Store diff --git a/app/controllers/recent_matches_controller.rb b/app/controllers/recent_matches_controller.rb index 99e754a..e838670 100644 --- a/app/controllers/recent_matches_controller.rb +++ b/app/controllers/recent_matches_controller.rb @@ -5,6 +5,12 @@ def index @recent_matches = CollectsRecentMatchesForUser.new.call(user: @current_user) end + def filter + load_current_user_profile + + @historical_matches = HistoricalMatch.where(filter_params).order(matched_on: :desc) + end + private def load_current_user_profile @@ -15,4 +21,8 @@ def load_current_user_profile @user_profile = SlackUserProfile.find_by(slack_user_id: @current_user.slack_user_id) end + + def filter_params + params.permit(:grouping) + end end diff --git a/app/views/recent_matches/_historical_match.html.erb b/app/views/recent_matches/_historical_match.html.erb new file mode 100644 index 0000000..36fc647 --- /dev/null +++ b/app/views/recent_matches/_historical_match.html.erb @@ -0,0 +1,24 @@ +
No matches made yet
+ <% else %> + <%= render partial: "historical_match", collection: @historical_matches %> + <% end %> +