Skip to content

Commit

Permalink
eventReducer: critical type bug fixed: zero must be string
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo Georgiev committed Dec 8, 2019
1 parent 32fa597 commit cea6df4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions services/sentry/lib/eventReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function mergeEv(initialMap = { eventCounts: {}, eventPayouts: {} }, ev, payout)
}
if (typeof ev.publisher !== 'string') return map
const earner = toBalancesKey(ev.publisher)
if (!map.eventCounts[earner]) map.eventCounts[earner] = new BN(0)
if (!map.eventPayouts[earner]) map.eventPayouts[earner] = new BN(0)
if (!map.eventCounts[earner]) map.eventCounts[earner] = '0'
if (!map.eventPayouts[earner]) map.eventPayouts[earner] = '0'

// increase the event count
const newEventCounts = new BN(map.eventCounts[earner], 10)
Expand Down
4 changes: 2 additions & 2 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ tape('should record clicks', async function(t) {

await postEvsAsCreator(leaderUrl, channel.id, evs)
// Technically we don't need to tick, since the events should be reflected immediately
const analytics = await fetch(`${leaderUrl}/analytics/${channel.id}?eventType=CLICK`).then(res =>
res.json()
const analytics = await fetch(`${leaderUrl}/analytics/${channel.id}?eventType=CLICK`).then(r =>
r.json()
)
t.equal(analytics.aggr[0].value, num.toString(), 'proper number of CLICK events')

Expand Down

0 comments on commit cea6df4

Please sign in to comment.