Hey everyone,
I am trying to retrieve all work_items
from the database and then add a calculated value to each of the work_items. I am stuck with this (that is not working):
def index(conn, _params) do
work_items = Tracking.list_work_items()
work_items =
work_items
for work_item <- work_items do
value = work_item_value(work_item)
work_item =
work_item
|> Map.put(:value, value)
end
render(conn, "index.html", work_items: work_items)
end
def work_item_value(work_item) do
work_item.duration_in_minutes/60 * work_item.hourly_rate_in_cents
end
Any elaboration would be appreciated!