mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
pets: bug fix - user.remove(path, idx, count) was wiping the whole
eggs/food arrays on page refresh, using array.splice &
user.set('items.food', splicedFood), etc
This commit is contained in:
parent
b32c6aead0
commit
7a5a4819e6
1 changed files with 9 additions and 2 deletions
|
|
@ -38,8 +38,15 @@ module.exports.app = (appExports, model) ->
|
|||
return alert "You already have that pet." if user.get('items.pets').indexOf("#{egg.name}-#{foodName}") != -1
|
||||
|
||||
user.push 'items.pets', egg.name + '-' + foodName
|
||||
user.remove 'items.food', foodIdx, 1
|
||||
user.remove 'items.eggs', eggIdx, 1
|
||||
|
||||
eggs.splice eggIdx, 1
|
||||
myFood.splice foodIdx, 1
|
||||
user.set 'items.eggs', eggs
|
||||
user.set 'items.food', myFood
|
||||
|
||||
#FIXME Bug: this removes from the array properly in the browser, but on refresh is has removed all items from the arrays
|
||||
# user.remove 'items.food', foodIdx, 1
|
||||
# user.remove 'items.eggs', eggIdx, 1
|
||||
|
||||
appExports.choosePet = (e, el) ->
|
||||
petArray = $(el).attr('data-pet').split '-'
|
||||
|
|
|
|||
Loading…
Reference in a new issue