Skip to content

Commit

Permalink
fix: Auto assignment tracking insert_id timestamp round to integer (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc authored Aug 24, 2023
1 parent 93d7966 commit e1710f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/node/src/assignment/assignment-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class AmplitudeAssignmentService implements AssignmentService {

event.insert_id = `${event.user_id} ${event.device_id} ${hashCode(
assignment.canonicalize(),
)} ${assignment.timestamp / DAY_MILLIS}`;
)} ${Math.floor(assignment.timestamp / DAY_MILLIS)}`;
return event;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ test('assignment to event as expected', async () => {
expect(Object.keys(userProperties['$set']).length).toEqual(1);
expect(Object.keys(userProperties['$unset']).length).toEqual(1);
const canonicalization = 'user device flag-key-1 on flag-key-2 control ';
const expected = `user device ${hashCode(canonicalization)} ${
assignment.timestamp / DAY_MILLIS
}`;
const expected = `user device ${hashCode(canonicalization)} ${Math.floor(
assignment.timestamp / DAY_MILLIS,
)}`;
expect(event.insert_id).toEqual(expected);
});

Expand Down

0 comments on commit e1710f1

Please sign in to comment.