Fix achievement loads never happening if you didn't earn any of them

This commit is contained in:
Nick Winter 2015-11-24 13:49:38 -08:00
parent 9f0a843593
commit b44714a60b

View file

@ -120,8 +120,10 @@ module.exports = class HeroVictoryModal extends ModalView
@thangTypes[thangTypeOriginal] = @supermodel.loadModel(thangType, 'thang').model @thangTypes[thangTypeOriginal] = @supermodel.loadModel(thangType, 'thang').model
@newEarnedAchievements = [] @newEarnedAchievements = []
hadOneCompleted = false
for achievement in @achievements.models for achievement in @achievements.models
continue unless achievement.completed continue unless achievement.completed
hadOneCompleted = true
ea = new EarnedAchievement({ ea = new EarnedAchievement({
collection: achievement.get('collection') collection: achievement.get('collection')
triggeredBy: @session.id triggeredBy: @session.id
@ -137,7 +139,7 @@ module.exports = class HeroVictoryModal extends ModalView
@updateSavingProgressStatus() @updateSavingProgressStatus()
me.fetch cache: false unless me.loading me.fetch cache: false unless me.loading
@readyToContinue = true if not @achievements.models.length @readyToContinue = true unless hadOneCompleted
# have to use a something resource because addModelResource doesn't handle models being upserted/fetched via POST like we're doing here # have to use a something resource because addModelResource doesn't handle models being upserted/fetched via POST like we're doing here
@newEarnedAchievementsResource = @supermodel.addSomethingResource('earned achievements') if @newEarnedAchievements.length @newEarnedAchievementsResource = @supermodel.addSomethingResource('earned achievements') if @newEarnedAchievements.length