Added proficiencies to printed sheet; some fixes

This commit is contained in:
Stefan Zermatten
2017-12-12 15:54:21 +02:00
parent 8349f7da9b
commit 64b3ca6066
8 changed files with 142 additions and 34 deletions

View File

@@ -0,0 +1,17 @@
removeDuplicateProficiencies = function(proficiencies) {
dict = {};
proficiencies.forEach(function(prof) {
if (prof.name in dict) { //if we have already gone over another proficiency for the same thing
if (dict[prof.name].value < prof.value) {
dict[prof.name] = prof; //then take the new one if it's higher, otherwise leave it
}
} else {
dict[prof.name] = prof; //if it wasn't already there, store it
}
});
profs = []
_.forEach(dict, function(prof) {
profs.push(prof);
})
return profs;
};