1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-03-06 15:55:25 +00:00

server - update view count on threads

This commit is contained in:
2018-01-10 21:01:32 -06:00
parent d3d3bef9a5
commit 392e6de14c
4 changed files with 37 additions and 2 deletions

View File

@@ -110,6 +110,14 @@ defmodule MyApp.Data.Thread do
end
end
# this doesn't update the 'updated_at' field which is what we want
def update_view_count(thread_id) do
query = from t in Data.Thread,
update: [inc: [view_count: 1]],
where: t.id == ^thread_id
Repo.update_all(query, [])
end
# TODO: delete thread
defp process_user_update(thread, _params) when is_nil(thread), do: {:error, "Invalid thread"}