Fix the inclusion of spurious day records.
Save some computation by iterating inside if block