mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix: Display beastmaster count even if member route returned no items
Because of this line:
f1286762a8/website/server/controllers/api-v3/members.js (L53)
We minimize any empty objects, which causes the statCalc methods to fail
This commit is contained in:
@@ -8,7 +8,7 @@ import content from './content/index';
|
|||||||
|
|
||||||
const DROP_ANIMALS = keys(content.pets);
|
const DROP_ANIMALS = keys(content.pets);
|
||||||
|
|
||||||
function beastMasterProgress (pets) {
|
function beastMasterProgress (pets = {}) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
each(DROP_ANIMALS, (animal) => {
|
each(DROP_ANIMALS, (animal) => {
|
||||||
@@ -19,7 +19,7 @@ function beastMasterProgress (pets) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dropPetsCurrentlyOwned (pets) {
|
function dropPetsCurrentlyOwned (pets = {}) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
each(DROP_ANIMALS, (animal) => {
|
each(DROP_ANIMALS, (animal) => {
|
||||||
@@ -30,7 +30,7 @@ function dropPetsCurrentlyOwned (pets) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mountMasterProgress (mounts) {
|
function mountMasterProgress (mounts = {}) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
each(DROP_ANIMALS, (animal) => {
|
each(DROP_ANIMALS, (animal) => {
|
||||||
@@ -41,7 +41,7 @@ function mountMasterProgress (mounts) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function remainingGearInSet (userGear, set) {
|
function remainingGearInSet (userGear = {}, set) {
|
||||||
let gear = filter(content.gear.flat, (item) => {
|
let gear = filter(content.gear.flat, (item) => {
|
||||||
let setMatches = item.klass === set;
|
let setMatches = item.klass === set;
|
||||||
let hasItem = userGear[item.key];
|
let hasItem = userGear[item.key];
|
||||||
@@ -54,7 +54,7 @@ function remainingGearInSet (userGear, set) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function questsOfCategory (userQuests, category) {
|
function questsOfCategory (userQuests = {}, category) {
|
||||||
let quests = filter(content.quests, (quest) => {
|
let quests = filter(content.quests, (quest) => {
|
||||||
let categoryMatches = quest.category === category;
|
let categoryMatches = quest.category === category;
|
||||||
let hasQuest = userQuests[quest.key];
|
let hasQuest = userQuests[quest.key];
|
||||||
|
|||||||
Reference in New Issue
Block a user