nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a8c7e3
)
contrib/nitrpg: also reward player for merged commits.
author
Alexandre Terrasa
<alexandre@moz-code.org>
Fri, 6 Feb 2015 17:26:07 +0000
(18:26 +0100)
committer
Alexandre Terrasa
<alexandre@moz-code.org>
Fri, 6 Feb 2015 22:29:53 +0000
(23:29 +0100)
contrib/nitrpg/src/reactors.nit
patch
|
blob
|
history
diff --git
a/contrib/nitrpg/src/reactors.nit
b/contrib/nitrpg/src/reactors.nit
index
33545b7
..
20319ca
100644
(file)
--- a/
contrib/nitrpg/src/reactors.nit
+++ b/
contrib/nitrpg/src/reactors.nit
@@
-29,6
+29,9
@@
class PlayerReactor
# Nitcoins rewarded when the player reviews a pull request.
var nc_pull_review = 2
# Nitcoins rewarded when the player reviews a pull request.
var nc_pull_review = 2
+ # Nitcoins rewarded when the player has a commit merged.
+ var nc_commit_merged = 1
+
redef fun react_event(game, e) do e.react_player_event(self, game)
end
redef fun react_event(game, e) do e.react_player_event(self, game)
end
@@
-44,10
+47,13
@@
redef class PullRequestEvent
# Rewards player for opened pull requests.
redef fun react_player_event(r, game) do
# Rewards player for opened pull requests.
redef fun react_player_event(r, game) do
+ var player = pull.user.player(game)
if action == "opened" then
if action == "opened" then
- var player = pull.user.player(game)
player.nitcoins += r.nc_pull_open
player.save
player.nitcoins += r.nc_pull_open
player.save
+ else if action == "closed" and pull.merged then
+ player.nitcoins += pull.commits * r.nc_commit_merged
+ player.save
end
end
end
end
end
end