Skip to content

Commit bc2a434

Browse files
committed
Fix average rate calculation in today's summary and update dev server config
1 parent 145fdf7 commit bc2a434

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"scripts": {
3-
"start": "servor --reload",
3+
"start": "servor www --reload",
44
"test": "jest",
55
"test:watch": "jest --watch",
66
"test:coverage": "jest --coverage"

www/js/modules/day.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ export const DayManager = {
284284
const labelClass = type === 'purchase' ? 'stat-value-info' : 'stat-value-success';
285285

286286
container.innerHTML = itemsArray.map(item => {
287-
const avgRate = item.rates.length > 0
288-
? (item.rates.reduce((a, b) => a + b, 0) / item.rates.length).toFixed(2)
287+
const avgRate = item.quantity > 0
288+
? (item.totalValue / item.quantity).toFixed(2)
289289
: 0;
290290

291291
return `

0 commit comments

Comments
 (0)