def redeem(self):
        """
        Update the redeem stats for this coupon.

        :return: Result of saving the record
        """
        self.times_redeemed += 1

        if self.max_redemptions:
            if self.times_redeemed >= self.max_redemptions:
                self.valid = False

        return db.session.commit()
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/blueprints/billing/models/coupon.py/Coupon.redeem/original