mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 04:38:55 +00:00
contrib: remove gems from admin section, update automatically when they
increase a level
This commit is contained in:
parent
c0d36f13ef
commit
242bcda96a
3 changed files with 9 additions and 5 deletions
4
migrations/20131108_add_gems_for_contribs.js
Normal file
4
migrations/20131108_add_gems_for_contribs.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Increase everyone's gems per their contribution level
|
||||
db.users.find({'contributor.level':{$gt:0}},{contributor:1, balance:1}).forEach(function(user){
|
||||
db.users.update({_id:user._id}, {$inc: {balance: (user.contributor.level * .5)} });
|
||||
});
|
||||
|
|
@ -55,8 +55,11 @@ api.updateMember = function(req, res) {
|
|||
},
|
||||
function(member, cb){
|
||||
if (!member) return res.json(404, {err: "User not found"});
|
||||
if (req.body.contributor.level > (member.contributor && member.contributor.level || 0)) member.flags.contributor = true;
|
||||
_.merge(member, _.pick(req.body, ['contributor', 'balance']));
|
||||
if (req.body.contributor.level > (member.contributor && member.contributor.level || 0)) {
|
||||
member.flags.contributor = true;
|
||||
member.balance += (req.body.contributor.level - member.contributor.level)*.5 // +2 gems per tier
|
||||
}
|
||||
_.merge(member, _.pick(req.body, 'contributor'));
|
||||
if (!member.items.pets) member.items.pets = [];
|
||||
var i = member.items.pets.indexOf('Dragon-Hydra');
|
||||
if (!~i && member.contributor.level >= 6) member.items.pets.push('Dragon-Hydra');
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@ script(id='partials/options.admin.html', type="text/ng-template")
|
|||
br
|
||||
small [1-7] this determines which items, pets, and mounts are available. Also determines name-tag coloring.
|
||||
a(target='_blank', href='https://trello.com/c/wkFzONhE/277-contributor-gear') More details.
|
||||
.control-group.option-medium
|
||||
input.option-content(type='number', step="any", ng-model='profile.balance')
|
||||
span.input-suffix $ (Gems/4)
|
||||
.control-group.option-medium
|
||||
label.checkbox
|
||||
input(type='checkbox', ng-model='profile.contributor.admin')
|
||||
|
|
|
|||
Loading…
Reference in a new issue