mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	support: Add basic information about realm.
Adds non-form section to Zulip Cloud support view with some basic realm information: organization type, plan type, non-guest user count and guest user count. Uses a shared template for the basic realm data and adds a shared support context dict for variables that are used in both remote and Zulip Cloud support views.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							349954e4fc
						
					
				
				
					commit
					44e73eecc1
				
			@@ -154,23 +154,27 @@ def get_cached_seat_count(realm: Realm) -> int:
 | 
			
		||||
    return get_latest_seat_count(realm)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_seat_count(
 | 
			
		||||
    realm: Realm, extra_non_guests_count: int = 0, extra_guests_count: int = 0
 | 
			
		||||
) -> int:
 | 
			
		||||
    non_guests = (
 | 
			
		||||
def get_non_guest_user_count(realm: Realm) -> int:
 | 
			
		||||
    return (
 | 
			
		||||
        UserProfile.objects.filter(realm=realm, is_active=True, is_bot=False)
 | 
			
		||||
        .exclude(role=UserProfile.ROLE_GUEST)
 | 
			
		||||
        .count()
 | 
			
		||||
    ) + extra_non_guests_count
 | 
			
		||||
 | 
			
		||||
    # This guest count calculation should match the similar query in render_stats().
 | 
			
		||||
    guests = (
 | 
			
		||||
        UserProfile.objects.filter(
 | 
			
		||||
            realm=realm, is_active=True, is_bot=False, role=UserProfile.ROLE_GUEST
 | 
			
		||||
        ).count()
 | 
			
		||||
        + extra_guests_count
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_guest_user_count(realm: Realm) -> int:
 | 
			
		||||
    # Same query to get guest user count as in render_stats in analytics/views/stats.py.
 | 
			
		||||
    return UserProfile.objects.filter(
 | 
			
		||||
        realm=realm, is_active=True, is_bot=False, role=UserProfile.ROLE_GUEST
 | 
			
		||||
    ).count()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_seat_count(
 | 
			
		||||
    realm: Realm, extra_non_guests_count: int = 0, extra_guests_count: int = 0
 | 
			
		||||
) -> int:
 | 
			
		||||
    non_guests = get_non_guest_user_count(realm) + extra_non_guests_count
 | 
			
		||||
    guests = get_guest_user_count(realm) + extra_guests_count
 | 
			
		||||
 | 
			
		||||
    # This formula achieves the pricing of the first 5*N guests
 | 
			
		||||
    # being free of charge (where N is the number of non-guests in the organization)
 | 
			
		||||
    # and each consecutive one being worth 1/5 the non-guest price.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user