Skip to content

Commit

Permalink
Fix: Missing balancing of MOL/contract based transactions.
Browse files Browse the repository at this point in the history
- Fields added to model
- processing during balance close implemented
  • Loading branch information
zoernert committed Jan 26, 2024
1 parent 2533941 commit 2bfddaf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion framework/docs
Submodule docs updated from 5c7125 to d20274
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
* Settings
*/
settings: {
fields: ["_id", "from", "to","epoch","label","energy","co2eq"]
fields: ["_id", "from", "to","epoch","label","energy","co2eq","accounting","contractId"]
},

/**
Expand Down
2 changes: 2 additions & 0 deletions framework/services/contract.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ module.exports = {
findContract[0].balanced += 1 * ctx.params.energy;
if(typeof findContract[0].id == 'undefined') findContract[0].id = findContract[0]._id;
await ctx.call("contract_model.update",findContract[0]);
// Add transactions to balances.

} else {
// Inconsistent data
console.error("contract.process: Inconsistent data for contractId: ",ctx.params.contractId);
Expand Down
1 change: 1 addition & 0 deletions framework/services/meritorder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ module.exports = {
// Identify relevant transactions and change balanced of contract
if(ctx.params.transactions[i].accounting == 'mol') {
await ctx.call("contract.process",ctx.params.transactions[i]);
await ctx.call("balance_settlements_active_model.insert",{entity:ctx.params.transactions[i]});
// Not handled in MOL!
}
}
Expand Down

0 comments on commit 2bfddaf

Please sign in to comment.