Comparing version 5.0.0-next.3 to 5.0.0-next.4
@@ -64,3 +64,3 @@ "use strict"; | ||
balance: { $sum: { $subtract: ["$credit", "$debit"] } }, | ||
count: { $sum: 1 }, | ||
notes: { $sum: 1 }, | ||
lastTransactionId: { $last: "$_id" }, | ||
@@ -75,6 +75,7 @@ lastTimestamp: { $last: "$timestamp" }, | ||
balance += balanceSnapshot.balance; | ||
notes += balanceSnapshot.notes; | ||
} | ||
if (result) { | ||
balance += parseFloat(result.balance.toFixed(this.precision)); | ||
notes = result.count; | ||
notes += result.notes; | ||
if (needToDoBalanceSnapshot && result.lastTransactionId) { | ||
@@ -88,2 +89,3 @@ await (0, balance_1.snapshotBalance)({ | ||
balance, | ||
notes, | ||
expireInSec: this.balanceSnapshotSec * 2, // Keep the document twice longer than needed in case this particular balance() query is not executed very often. | ||
@@ -90,0 +92,0 @@ }, options); |
@@ -14,2 +14,3 @@ "use strict"; | ||
balance: Number, | ||
notes: Number, | ||
createdAt: Date, | ||
@@ -50,2 +51,3 @@ expireAt: Date, | ||
balance: balanceData.balance, | ||
notes: balanceData.notes, | ||
createdAt: new Date(), | ||
@@ -52,0 +54,0 @@ expireAt: new Date(Date.now() + balanceData.expireInSec * 1000), |
{ | ||
"name": "medici", | ||
"version": "5.0.0-next.3", | ||
"version": "5.0.0-next.4", | ||
"description": "Simple double-entry accounting for Node + Mongoose", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69451
1076