Is there a way to make sure we increase the discount coupon used-time only when the order was completed? Or to reset the used-time number so that the user can still use the unused discount code in another order?

I restrict the no. of time the coupon(e.g. 1 time only) can be used but once the coupon is applied(even though the order is still pending or cancelled), the coupon is no longer valid. This is causing issue and admin hours. Anyone has the same issue? How do you deal with it?