(toggle)
return last_used
Returns usage information for each toggle
Returns usage information for each toggle
Returns usage information for each toggle
def _get_usage_info(toggle):
    """Returns usage information for each toggle
    """
    last_used = {}
    active_domains = 0
    for enabled in toggle.enabled_users:
        name = _enabled_item_name(enabled)
        if _namespace_domain(enabled):
            last_form_submission = get_last_form_submission_received(name)
            last_used[name] = _format_date(last_form_submission)
            if last_form_submission:
                active_domains += 1
        else:
            try:
                user = CouchUser.get_by_username(name)
                last_used[name] = _format_date(user.last_login) if user else NOT_FOUND
            except ResourceNotFound:
                last_used[name] = NOT_FOUND
    last_used["_latest"] = _get_most_recently_used(last_used)
    last_used["_active_domains"] = active_domains
    return last_used
def _get_usage_info ( toggle ) : last_used = { } active_domains = 0 for enabled in toggle . enabled_users : name = _enabled_item_name ( enabled ) if _namespace_domain ( enabled ) : last_form_submission = get_last_form_submission_received ( name ) last_used [ name ] = _format_date ( last_form_submission ) if last_form_submission : active_domains += 1 else : try : user = CouchUser . get_by_username ( name ) last_used [ name ] = _format_date ( user . last_login ) if user else NOT_FOUND except ResourceNotFound : last_used [ name ] = NOT_FOUND last_used [ "_latest" ] = _get_most_recently_used ( last_used ) last_used [ "_active_domains" ] = active_domains return last_used