Skip to content

Commit

Permalink
fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeheft committed Jul 7, 2024
1 parent f6dfa42 commit e09484b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class ApplicationController < ActionController::API
params.permit(:limit, :offset)
end
private def limit
pagination_params[:limit]&.to_i || 2
pagination_params[:limit] || 2
end

private def offset
pagination_params[:offset]&.to_i || 0
pagination_params[:offset] || 0
end
end
4 changes: 2 additions & 2 deletions lib/rides/commands/get_routes_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def call(rides:)
data = data.select { _1[:originIndex] == _1[:destinationIndex] }
data = transform_keys!(data)

combine_routes_data!(data)
combine_routes_data!(data, rides)
end

# The manner in which jsonapi-serializer serialzies pojos,
# in order to adhere to the json api spec, we need to define
# the id _and_ the object iteself.
private def combine_routes_data!(data)
private def combine_routes_data!(data, rides)
data.map.with_index do |d, idx|
ride = rides[idx]
OpenStruct.new(ride_id: ride.id, from_address_id: ride.from_address&.id,
Expand Down
4 changes: 2 additions & 2 deletions lib/rides/commands/rank_rides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def call(driver:)
"Please check the ride(s) configuration and try again."
end

combine_rides!(rides)
combine_rides!(rides, commutes)
end

# Combines the duration data for the driver to get to the start of the ride
# with that of the ride's data, e.g., duration, distance
private def combine_rides!(rides)
private def combine_rides!(rides, commutes)
rides.map.with_index do |ride, idx|
commute = commutes.fetch(idx)
commute_duration = commute.duration
Expand Down

0 comments on commit e09484b

Please sign in to comment.