fix: check count

This commit is contained in:
Bai 2025-07-01 15:31:55 +08:00 committed by feng626
parent 60deef2abf
commit c3f877d116

View File

@ -131,17 +131,18 @@ class LicenseEditionChoices(models.TextChoices):
if choice == key:
return choice
return LicenseEditionChoices.COMMUNITY
@staticmethod
def parse_license_edition(info):
count = info.get('license', {}).get('count', 0)
if 50 >= count > 0:
if 0 < count <= 50:
return LicenseEditionChoices.BASIC
elif count <= 500:
return LicenseEditionChoices.STANDARD
elif count < 5000:
elif count <= 5000:
return LicenseEditionChoices.PROFESSIONAL
elif count >= 5000:
elif count > 5000:
return LicenseEditionChoices.ULTIMATE
else:
return LicenseEditionChoices.COMMUNITY