Skip to content

Commit

Permalink
Prevent throwing server error when filtering activities with invalid …
Browse files Browse the repository at this point in the history
…dates
  • Loading branch information
Kostas Sklias committed Feb 6, 2024
1 parent 704b8b1 commit cc678cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def filter_activities(activities)
next if value.blank?

if key == 'since'
value = DateTime.parse(value).beginning_of_day
value = DateTime.parse(value).beginning_of_day rescue ArgumentError
activities = activities.since value
elsif key == 'before'
value = DateTime.parse(value).end_of_day
value = DateTime.parse(value).end_of_day rescue ArgumentError
activities = activities.before value
elsif ['user_id', 'trackable_type'].include? key
activities = activities.where(key.to_sym => value)
Expand Down

0 comments on commit cc678cd

Please sign in to comment.