mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Check for valid director API keys
This commit is contained in:
@@ -40,12 +40,16 @@ class EVEPlayerCorporation(EVEAPIModel):
|
||||
""" Returns the number of characters with stored API keys """
|
||||
return self.eveplayercharacter_set.filter(eveaccount__isnull=False).count()
|
||||
|
||||
@property
|
||||
def director_api_keys(self):
|
||||
return self.directors.filter(eveaccount__isnull=False, eveaccount__api_keytype=API_KEYTYPE_FULL, eveaccount__api_status=API_STATUS_OK)
|
||||
|
||||
@property
|
||||
def api_key_coverage(self):
|
||||
""" Returns the percentage coverage of API keys for the corporation's members """
|
||||
|
||||
# Check if we have a full director key, see if we can base our assumptions off what is in auth already
|
||||
if self.directors.filter(eveaccount__isnull=False, eveaccount__api_keytype=API_KEYTYPE_FULL).count():
|
||||
if self.director_api_keys.count():
|
||||
membercount = self.eveplayercharacter_set.count()
|
||||
else:
|
||||
membercount = self.member_count
|
||||
|
||||
Reference in New Issue
Block a user