From acac231a7d566796a6a0a9475e2941d2e5077b94 Mon Sep 17 00:00:00 2001 From: enkogu Date: Thu, 20 Dec 2018 12:47:16 +0700 Subject: [PATCH] getDebtMultiplier fix --- contracts/ether/WeiExpense.sol | 2 +- test/moneyflow.tests.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/ether/WeiExpense.sol b/contracts/ether/WeiExpense.sol index 9a8167f..37cfbf3 100644 --- a/contracts/ether/WeiExpense.sol +++ b/contracts/ether/WeiExpense.sol @@ -146,7 +146,7 @@ contract WeiExpense is IWeiReceiver, IDestination, Ownable { function getDebtMultiplier()public view returns(uint) { // if periodic, period already passed from last receive, but amount is not sliding - if((isPeriodic) && (!isSlidingAmount) && (((block.timestamp - momentReceived) / (periodHours * 3600 * 1000)) > 1)) { + if((isPeriodic) && (!isSlidingAmount) && (((block.timestamp - momentReceived) / (periodHours * 3600 * 1000)) >= 1)) { if(0 != partsPerMillion) { return 1; } else { diff --git a/test/moneyflow.tests.js b/test/moneyflow.tests.js index 57985d8..1fbc947 100644 --- a/test/moneyflow.tests.js +++ b/test/moneyflow.tests.js @@ -264,7 +264,7 @@ contract('Moneyflow', (accounts) => { var needsEmployee1 = await Employee1.isNeedsMoney({ from: creator }); assert.equal(needsEmployee1, false, 'Dont need money, because he got it'); - await passHours(timePeriod); + await passHours(timePeriod + 1); var needsEmployee2 = await Employee1.isNeedsMoney({ from: creator }); assert.equal(needsEmployee2, true, 'Need money, because 24 hours passed'); @@ -307,15 +307,15 @@ contract('Moneyflow', (accounts) => { var need = await Employee1.getTotalWeiNeeded(10000*money); assert.equal(need.toNumber(), 0); - await passHours(1*timePeriod); + await passHours(1*timePeriod + 1); var need = await Employee1.getTotalWeiNeeded(10000*money); assert.equal(need.toNumber(), 1000*money); - await passHours(1*timePeriod); + await passHours(1*timePeriod + 1); var need = await Employee1.getTotalWeiNeeded(10000*money); assert.equal(need.toNumber(), 2000*money); - await passHours(1*timePeriod); + await passHours(1*timePeriod + 1); var need = await Employee1.getTotalWeiNeeded(10000*money); assert.equal(need.toNumber(), 3000*money);