This was working in Phoenix 1.4.x
, now fails with error:
def adjust_stock(move_list, source, ref) do
move_list
|> Stream.map(fn move ->
StockWeb.Helpers.atomize(move)
end)
|> Stream.map(fn move ->
current = # this line fails to compile
Stock.Repo.one(
Stock.Moves.Move
|> join(:left, [m], item in Stock.Items.Item, m.item_id == item.id)
|> where([m, item], item.effective_item_id == ^move.item_id)
|> where([m, item], m.stock_count == 1)
|> where([m, item], m.flag == 1)
|> where([m, item], item.status == 1)
|> select([m, item], sum(m.quantity))
)
Error:
== Compilation error in file lib/stock/moves/moves.ex ==
** (FunctionClauseError) no function clause matching in Ecto.Query.join/5
expanding macro: Ecto.Query.join/5
lib/stock/moves/moves.ex:116: Stock.Moves.adjust_stock/3