minor renaming

This commit is contained in:
2024-12-26 10:45:01 -07:00
parent 26b9c7f0d5
commit e72ee2c919

View File

@@ -6,6 +6,7 @@ const { PDFDocument } = require('pdf-lib')
const year = 2024 const year = 2024
const txs = csvToJson.fieldDelimiter(',').getJsonFromCsv(`../Ledger.csv`) const txs = csvToJson.fieldDelimiter(',').getJsonFromCsv(`../Ledger.csv`)
let lots = [] let lots = []
let dispositions = [] let dispositions = []
@@ -72,20 +73,20 @@ const consumeLots = (tx) => {
Remaining: tx.Remaining, Remaining: tx.Remaining,
} }
} else if (!stLot) { } else if (!stLot) {
lot = lots.find(u => u.Id === ltLot.Id) lot = lots.find(l => l.Id === ltLot.Id)
st = false st = false
} else if (!ltLot) { } else if (!ltLot) {
lot = lots.find(u => u.Id === stLot.Id) lot = lots.find(l => l.Id === stLot.Id)
st = true st = true
} else { } else {
const { Tax: stTax } = getProvisional(tx, stLot, true) const { Tax: stTax } = getProvisional(tx, stLot, true)
const { Tax: ltTax } = getProvisional(tx, ltLot, false) const { Tax: ltTax } = getProvisional(tx, ltLot, false)
if (new BN(stTax).lt(ltTax)) { if (new BN(stTax).lt(ltTax)) {
lot = lots.find(u => u.Id === stLot.Id) lot = lots.find(l => l.Id === stLot.Id)
st = true st = true
} else { } else {
lot = lots.find(u => u.Id === ltLot.Id) lot = lots.find(l => l.Id === ltLot.Id)
st = false st = false
} }
} }
@@ -127,9 +128,9 @@ let balances = lots.reduce((prev, curr) => {
return prev return prev
}, {}) }, {})
lots = lots.map(u => ({ lots = lots.map(l => ({
...u, ...l,
Remaining: u.Remaining.toFixed(8), Remaining: l.Remaining.toFixed(8),
})) }))
balances = Object.keys(balances) balances = Object.keys(balances)