diff --git a/lib/dotcom/cache/key_generator.ex b/lib/dotcom/cache/key_generator.ex index 720b5e411d..fe52ef101c 100644 --- a/lib/dotcom/cache/key_generator.ex +++ b/lib/dotcom/cache/key_generator.ex @@ -24,7 +24,7 @@ defmodule Dotcom.Cache.KeyGenerator do mod |> Kernel.to_string() |> String.split(".") - |> (fn [_ | tail] -> tail end).() + |> Kernel.tl() |> Enum.map_join(".", &Recase.to_snake/1) |> String.downcase() end diff --git a/lib/dotcom/cache/trip_plan_feedback/key_generator.ex b/lib/dotcom/cache/trip_plan_feedback/key_generator.ex index 84aa1371fc..e554190cd6 100644 --- a/lib/dotcom/cache/trip_plan_feedback/key_generator.ex +++ b/lib/dotcom/cache/trip_plan_feedback/key_generator.ex @@ -24,7 +24,7 @@ defmodule Dotcom.Cache.TripPlanFeedback.KeyGenerator do mod |> Kernel.to_string() |> String.split(".") - |> (fn [_ | tail] -> tail end).() + |> Kernel.tl() |> Enum.map_join(".", &Recase.to_snake/1) |> String.downcase() end diff --git a/lib/dotcom/trip_plan/map.ex b/lib/dotcom/trip_plan/map.ex index f8847650d1..a09fccd624 100644 --- a/lib/dotcom/trip_plan/map.ex +++ b/lib/dotcom/trip_plan/map.ex @@ -68,7 +68,7 @@ defmodule Dotcom.TripPlan.Map do polyline |> Polyline.decode() - |> (fn line -> Enum.concat([[from], line, [to]]) end).() + |> Kernel.then(fn line -> Enum.concat([[from], line, [to]]) end) |> Polyline.encode() end diff --git a/lib/dotcom_web/controllers/schedule/schedule_api.ex b/lib/dotcom_web/controllers/schedule/schedule_api.ex index 545a202e4a..61d7241c7a 100644 --- a/lib/dotcom_web/controllers/schedule/schedule_api.ex +++ b/lib/dotcom_web/controllers/schedule/schedule_api.ex @@ -73,7 +73,7 @@ defmodule DotcomWeb.ScheduleController.ScheduleApi do fn trip_id -> services_by_trip[trip_id] |> List.first() - |> (fn sched -> sched.time end).() + |> Map.get(:time) end, &date_sorter/2 ) diff --git a/lib/trip_info.ex b/lib/trip_info.ex index d86cbc4456..25e57cc663 100644 --- a/lib/trip_info.ex +++ b/lib/trip_info.ex @@ -82,7 +82,7 @@ defmodule TripInfo do List |> apply(list_function, [times]) |> PredictedSchedule.stop() - |> (fn stop -> stop.id end).() + |> Map.get(:id) end defp do_from_list( diff --git a/test/dotcom_web/controllers/helpers_test.exs b/test/dotcom_web/controllers/helpers_test.exs index 97fdf75e35..c27d680be5 100644 --- a/test/dotcom_web/controllers/helpers_test.exs +++ b/test/dotcom_web/controllers/helpers_test.exs @@ -216,7 +216,7 @@ defmodule DotcomWeb.ControllerHelpersTest do |> assign(:route, route) |> assign(:direction_id, 1) |> assign_alerts([]) - |> (fn conn -> conn.assigns.alerts end).() + |> Kernel.then(fn conn -> conn.assigns.alerts end) expected = [@commuter_rail_alert, @worcester_alert, @worcester_inbound_alert] assert alerts == expected @@ -231,7 +231,7 @@ defmodule DotcomWeb.ControllerHelpersTest do |> assign(:route, route) |> assign(:direction_id, 0) |> assign_alerts([]) - |> (fn conn -> conn.assigns.alerts end).() + |> Kernel.then(fn conn -> conn.assigns.alerts end) expected = [@commuter_rail_alert, @worcester_alert] assert alerts == expected @@ -246,7 +246,7 @@ defmodule DotcomWeb.ControllerHelpersTest do |> assign(:route, route) |> assign(:direction_id, nil) |> assign_alerts([]) - |> (fn conn -> conn.assigns.alerts end).() + |> Kernel.then(fn conn -> conn.assigns.alerts end) expected = [@commuter_rail_alert, @worcester_alert, @worcester_inbound_alert] assert alerts == expected @@ -260,7 +260,7 @@ defmodule DotcomWeb.ControllerHelpersTest do |> assign(:date_time, Timex.now()) |> assign(:route, route) |> assign_alerts([]) - |> (fn conn -> conn.assigns.alerts end).() + |> Kernel.then(fn conn -> conn.assigns.alerts end) expected = [@commuter_rail_alert, @worcester_alert, @worcester_inbound_alert] assert alerts == expected @@ -294,7 +294,7 @@ defmodule DotcomWeb.ControllerHelpersTest do |> assign(:route, route) |> assign(:direction_id, 0) |> assign_alerts([]) - |> (fn conn -> conn.assigns.alerts end).() + |> Kernel.then(fn conn -> conn.assigns.alerts end) expected = [@commuter_rail_alert, @worcester_alert, worcester_ambiguous_alert] assert alerts == expected