Skip to content

Commit

Permalink
update client2 to use the baseCharge field from the enriched reading obj
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiosilveira committed Sep 18, 2022
1 parent d3a7250 commit 0871d35
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client2.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { acquireReading } = require('./reading');
const { baseRate, taxThreshold } = require('./tax-utils');
const { acquireReading, enrichReading } = require('./reading');
const { taxThreshold } = require('./tax-utils');

const aReading = acquireReading();
const base = baseRate(aReading.month, aReading.year) * aReading.quantity;
const rawReading = acquireReading();
const aReading = enrichReading(rawReading);
const base = aReading.baseCharge;
const taxableCharge = Math.max(0, base - taxThreshold(aReading.year));

console.log(`base charge is ${base}`);
Expand Down

0 comments on commit 0871d35

Please sign in to comment.