Do not re-add all IDs if just stamping existing IDs

Reported by Daniel Vieiralves.
Use inclusive range so that upper bound will be found.

This is a rare error where the upper bound might not be included.
The main issue would be if the metric returned 1.0 instead of
only something very close.