learning123
"(FunctionClauseError) no function clause matching" error
Hey all, I’m new to elixir and getting the following error:
** (FunctionClauseError) no function clause matching in TSS.DriverStatuses.list_assignable_drivers_by_truck_load/1
So in my module, I define a get_remaining_time function that takes a truck_load:
defp get_remaining_time(truck_load) do
time_since_available = DriverStatuses.list_assignable_drivers_by_truck_load(truck_load)
Formatters.decorate_time_since_available(time_since_available)
end
This function uses the list_assignable_drivers_by_truck_load in the DriverStatuses module, which looks like this:
def list_assignable_drivers_by_truck_load(%TruckLoad{
well: %{id: well_id},
pull_point: pull_point
}) do
base_assignable_drivers_query()
|> apply_default_select(pull_point.point)
|> filter({:well_id, well_id})
|> sort({:distance_in_meters, :asc}, %{"pull_point_id" => pull_point.id})
|> preload(driver: [:trailer_type, driver_contract: [:carrier]])
|> Repo.all()
end
and then formats it using the decorate_time_since_available function in the Formatters module, which looks like this:
def decorate_time_since_available(%{driver_status: %{last_available_at: last_available_at}})
when not is_nil(last_available_at),
do:
humanize_time(DateTime.diff(DateTime.utc_now(), last_available_at), :seconds, :minutes) <>
" (hh:mm)"
def decorate_time_since_available(_), do: "N/A"
Finally, I am calling the function like so:
<CardInfo label="Time Since Available" title={{ get_remaining_time(@truck_load) }} small />
I think I’m not pattern matching correctly, but nothing I’ve tried is working. How can I fix this?
Thanks so much!!
Most Liked Responses
derek-zhou
So your @truck_load is not a %TruckLoad(...} then. the error message after the ** (FunctionClausError)... line should give you more clue
2
Popular in Questions
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
can someone please explain to me how Enum.reduce works with maps
New
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
The documentation above suggests that while ...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Other popular topics
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help.
Where are they similar?
Where do they differ the m...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #podcasts
- #code-sync
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








