mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Use distinct counts, avoid duplicating up on API keys
This commit is contained in:
@@ -38,12 +38,12 @@ class EVEPlayerCorporation(EVEAPIModel):
|
|||||||
@property
|
@property
|
||||||
def api_keys(self):
|
def api_keys(self):
|
||||||
""" Returns the number of characters with stored API keys """
|
""" Returns the number of characters with stored API keys """
|
||||||
return self.eveplayercharacter_set.filter(eveaccount__isnull=False).count()
|
return self.eveplayercharacter_set.filter(eveaccount__isnull=False).distinct().count()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_api_keys(self):
|
def active_api_keys(self):
|
||||||
""" Returns the number of characters with stored and active API keys """
|
""" Returns the number of characters with stored and active API keys """
|
||||||
return self.eveplayercharacter_set.filter(eveaccount__isnull=False, eveaccount__api_status=API_STATUS_OK).count()
|
return self.eveplayercharacter_set.filter(eveaccount__isnull=False, eveaccount__api_status=API_STATUS_OK).distinct().count()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def director_api_keys(self):
|
def director_api_keys(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user