Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean: remove new rider logic. #386

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/bike_brigade/riders.ex
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ defmodule BikeBrigade.Riders do
end
end

# TODO: make it pretty
# TODO This may not be needed, i think it's only used when creating riders from a form input which we don't seem to do?
def create_rider_with_tags(attrs \\ %{}, tags \\ [], opts \\ []) do
%Rider{}
|> Rider.changeset(attrs)
|> Rider.tags_changeset(tags)
|> Repo.insert(opts)
|> broadcast(:rider_created)
end

@doc """
Updates a rider.

Expand Down
15 changes: 0 additions & 15 deletions lib/bike_brigade_web/live/rider_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,6 @@ defmodule BikeBrigadeWeb.RiderLive.FormComponent do
save_rider_edit_impl(socket, rider_form_params)
end

# TODO: this can probably be deleted: we don't really create riders from the form?
# https://github.com/bikebrigade/dispatch/issues/321
defp save_rider(socket, :new, rider_params) do
case Riders.create_rider_with_tags(rider_params, rider_params["tags"]) do
{:ok, _rider} ->
{:noreply,
socket
|> put_flash(:info, "Rider created successfully")
|> push_navigate(to: socket.assigns.navigate)}

{:error, %Ecto.Changeset{} = changeset} ->
{:noreply, assign(socket, changeset: changeset)}
end
end

defp save_rider_edit_impl(socket, rider_form_params) do
rider_form_params = Map.merge(%{"tags" => []}, rider_form_params)

Expand Down
1 change: 0 additions & 1 deletion lib/bike_brigade_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ defmodule BikeBrigadeWeb.Router do

live_session :dispatch, on_mount: {LiveHooks.Authentication, :require_dispatcher} do
live "/riders", RiderLive.Index, :index
live "/riders/new", RiderLive.Index, :new
live "/riders/message", RiderLive.Index, :message
# this is mostly used for testing!
live "/riders/map", RiderLive.Index, :map
Expand Down
Loading