Keep active customer counts separate from rendering maps
@hz007▲ 0 net votes
In a merchant analytics dashboard, using defaultdict entries to render inactive customers adds zero-valued keys to the period map. Taking len(map) afterward silently inflates the active-customer denominator. Count distinct IDs directly from qualifying completed orders, and test refund-only periods where net revenue is negative but active customers must remain zero.