Removed update stats notification (#10324)

This commit is contained in:
Keith Holliday
2018-05-04 08:17:22 -05:00
committed by GitHub
parent f7415df6ba
commit 8e04d6e284
2 changed files with 12 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ describe('common.fns.updateStats', () => {
beforeEach(() => { beforeEach(() => {
user = generateUser(); user = generateUser();
user.addNotification = sinon.spy(); // user.addNotification = sinon.spy();
}); });
context('No Hp', () => { context('No Hp', () => {
@@ -110,14 +110,14 @@ describe('common.fns.updateStats', () => {
expect(user.stats.points).to.eql(10); expect(user.stats.points).to.eql(10);
}); });
it('add user notification when drops are enabled', () => { xit('add user notification when drops are enabled', () => {
user.stats.lvl = 3; user.stats.lvl = 3;
updateStats(user, { }); updateStats(user, { });
expect(user.addNotification).to.be.calledOnce; expect(user.addNotification).to.be.calledOnce;
expect(user.addNotification).to.be.calledWith('DROPS_ENABLED'); expect(user.addNotification).to.be.calledWith('DROPS_ENABLED');
}); });
it('add user notification when the user levels up', () => { xit('add user notification when the user levels up', () => {
const initialLvl = user.stats.lvl; const initialLvl = user.stats.lvl;
updateStats(user, { updateStats(user, {
exp: 3000, exp: 3000,
@@ -129,7 +129,7 @@ describe('common.fns.updateStats', () => {
}); });
}); });
it('add user notification when rebirth is enabled', () => { xit('add user notification when rebirth is enabled', () => {
user.stats.lvl = 51; user.stats.lvl = 51;
updateStats(user, { }); updateStats(user, { });
expect(user.addNotification).to.be.calledTwice; // once is for drops enabled expect(user.addNotification).to.be.calledTwice; // once is for drops enabled

View File

@@ -20,7 +20,7 @@ module.exports = function updateStats (user, stats, req = {}, analytics) {
if (stats.exp >= experienceToNextLevel) { if (stats.exp >= experienceToNextLevel) {
user.stats.exp = stats.exp; user.stats.exp = stats.exp;
const initialLvl = user.stats.lvl; // const initialLvl = user.stats.lvl;
while (stats.exp >= experienceToNextLevel) { while (stats.exp >= experienceToNextLevel) {
stats.exp -= experienceToNextLevel; stats.exp -= experienceToNextLevel;
@@ -50,12 +50,13 @@ module.exports = function updateStats (user, stats, req = {}, analytics) {
} }
} }
const newLvl = user.stats.lvl; // @TODO: Tmp disable to see if this is causing concurrency
// const newLvl = user.stats.lvl;
if (user.addNotification) user.addNotification('LEVELED_UP', { //
initialLvl, // if (user.addNotification) user.addNotification('LEVELED_UP', {
newLvl, // initialLvl,
}); // newLvl,
// });
} }
user.stats.exp = stats.exp; user.stats.exp = stats.exp;