Skip to content

Commit c4cf7fc

Browse files
committed
Fixed consistency issue with updating freebieSpent value in firebase.
1 parent 9c43803 commit c4cf7fc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

characterData/loadService.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ app.service("LoadService",
218218
CharCreatorService.charGeneration = character.generation;
219219
CharCreatorService.freebiePts = character.freebiePts;
220220
CharCreatorService.freebieSpent = character.freebieSpent;
221+
if(character.freebieSpent == null) //Error checking that freebieSpent update.
222+
CharCreatorService.freebieSpent = ((15 + character.addedFlawPts) - character.freebiePts);
221223
CharCreatorService.freebieMode = character.freebieMode;
222224
var clanIndex = ClanService.clanList.map(function(clan){
223225
return clan.name;

characterData/saveService.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,22 @@ app.service("SaveService",
103103
addedFlawPts: MeritFlawService.addedFlawPts
104104
};
105105

106+
errorCheckPriorities(charData.abilityPriorities);
107+
errorCheckPriorities(charData.attributePriorities);
108+
106109
var updates = {};
107110
updates[savePath] = charData;
108111
return firebase.database().ref().update(updates);
109112
}
110113

114+
this.errorCheckPriorities = errorCheckPriorities;
115+
function errorCheckPriorities(priorityArray){
116+
for(var i = 0; i < priorityArray.length; i++){
117+
if(priorityArray[i]==null)
118+
priorityArray[i] = "";
119+
}
120+
}
121+
111122
this.removeHashKeys = removeHashKeys;
112123
function removeHashKeys(ability){
113124
for(var i = 0; i<ability.points.length; i++){

0 commit comments

Comments
 (0)