nitrpg: better check for review comment achievements
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 16 Oct 2015 15:07:06 +0000 (11:07 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sat, 24 Oct 2015 17:59:11 +0000 (13:59 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitrpg/src/reactors.nit

index 7073c98..da8b212 100644 (file)
@@ -95,14 +95,18 @@ redef class IssueCommentEvent
        # Rewards player for review comments.
        #
        # TODO only give nitcoins if reviewers < 2
+       # TODO give more points to first reviewer
        redef fun react_player_event(r, game) do
                if comment.is_ack then
                        react_player_review(r, game)
                end
        end
 
+       # TODO same player should not be authorized to review multiple times? How to handle rerols?
        private fun react_player_review(r: PlayerReactor, game: Game) do
+               if issue.state == "closed" then return
                var player = comment.user.player(game)
+               if issue.user == player.user then return
                player.nitcoins += r.nc_pull_review
                player.save
                var event = player_reward_event("pull_review", player, r.nc_pull_review)