def list_active_customers(): """Return the number of customers with an active_status of True.""" try: connect_customer_db() active_count = Customer.select().where( Customer.active_customer).count() logger.info(f"There are currently {active_count} active customers.") return active_count finally: db.close()
def list_credit_limits(): """Return a list of active customers along with their credit limits.""" try: connect_customer_db() # Creates a list of all active customers active_customers = Customer.select().where(Customer.active_customer) # Lists credit limits for those customers logger.info(f"Listing credit limits for all active customers.") return [ f"{cust.last_name}, {cust.first_name}: {cust.credit_limit}" for cust in active_customers ] finally: db.close()
def list_active_customers(): """Give a count of only active status customers in the database""" active_customers = Customer.select().where(Customer.active_status).count() logging.info(f"The number of active customers is {active_customers}") return active_customers