diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/cldb.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/cldb.erl b/server/cldb.erl index 6f6f4d2..3886685 100644 --- a/server/cldb.erl +++ b/server/cldb.erl @@ -29,4 +29,22 @@ register(User, Pwd, Root) -> {_, Reason} = mnesia:transaction(F), Reason. +decVote(User, Pwd) -> + F = fun() -> + [Head|_] = ask(User, Pwd), + Votes = Head#user.votes - 1, + New = Head#user{votes = Votes}, + mnesia:write(New) + end, + mnesia:transaction(F). + +incVote(User, Pwd) -> + F = fun() -> + [Head|_] = ask(User, Pwd), + Votes = Head#user.votes + 1, + New = Head#user{votes = Votes}, + mnesia:write(New) + end, + mnesia:transaction(F). + |