From a7da403571956682aa339003064860a89a953385 Mon Sep 17 00:00:00 2001 From: Absurdon Date: Sat, 14 Apr 2018 13:24:05 +0200 Subject: [PATCH] Fixing steamId not beeing set properly so hive id could not be retrieved --- lib/hive/stats_wrapper.js | 5 +---- lib/user/user.js | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/hive/stats_wrapper.js b/lib/hive/stats_wrapper.js index 6c0bf8a..4685b92 100644 --- a/lib/hive/stats_wrapper.js +++ b/lib/hive/stats_wrapper.js @@ -88,10 +88,7 @@ const StatAttributes = { } }; -function UserStatisticsWrapper (apiResponse) { - if(apiResponse === undefined) { - apiResponse = {}; - } +function UserStatisticsWrapper (apiResponse = {}) { for (let attr in StatAttributes) { let adapter = StatAttributes[attr]; this[attr] = apiResponse[adapter.v1] || diff --git a/lib/user/user.js b/lib/user/user.js index 3c97a46..7735bd4 100644 --- a/lib/user/user.js +++ b/lib/user/user.js @@ -26,7 +26,7 @@ function User (user) { this.bans = user['bans']; if (user['steam']) { this.steam = { - id: user['steam']['id'] || null, + id: user['steam']['id'] || this.getSteamId(), url: user['steam']['url'] || null, nickname: user['steam']['nickname'] || null }; @@ -42,7 +42,7 @@ function User (user) { id: null }; - if (this.steam.url) { + if (this.steam.id) { this.hive.id = this.getHiveId(); } }