mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +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
|
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.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) ->
|
appExports.choosePet = (e, el) ->
|
||||||
petArray = $(el).attr('data-pet').split '-'
|
petArray = $(el).attr('data-pet').split '-'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue