diff options
author | Marco Ziener <mziener@lavabit.com> | 2010-10-14 16:03:19 +0200 |
---|---|---|
committer | Marco Ziener <mziener@lavabit.com> | 2010-10-14 16:03:19 +0200 |
commit | d4974ca3ef2f4e664a78912837989762997d14dd (patch) | |
tree | ae19fffd9b607110598f3a2b4479adb6fe98b65f /server | |
parent | be34a99dbb4e516d7592d6a19d0c662b6d81ab17 (diff) | |
download | erlang-d4974ca3ef2f4e664a78912837989762997d14dd.tar.gz erlang-d4974ca3ef2f4e664a78912837989762997d14dd.tar.xz erlang-d4974ca3ef2f4e664a78912837989762997d14dd.zip |
Finished
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). + |