Skip to content

Commit 1c0c654

Browse files
committed
Fix profit loss calculation again
1 parent 973e583 commit 1c0c654

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/shared/services/score-keeper.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ export class ScoreKeeperService {
3131
this.total += sum;
3232
console.log('Adding pl ', this.profitLossHash[stock], sum);
3333
if (this.profitLossHash[stock]) {
34-
this.profitLossHash[stock] = Number(this.profitLossHash[stock]) + sum;
34+
this.profitLossHash[stock] = Number(this.profitLossHash[stock].toFixed(2)) + sum;
3535
} else {
3636
this.profitLossHash[stock] = sum;
3737
}
3838
console.log('Final pl ', this.profitLossHash[stock]);
3939

4040
this.addSell(stock, sum);
41-
const log = `${this.profitLossHash[stock].toFixed()}`;
41+
const log = `${this.profitLossHash[stock].toFixed(2)}`;
4242
console.log(stock, ': ', log);
4343
this.reportingService.addAuditLog(stock, log);
4444
}

0 commit comments

Comments
 (0)