Check for valid director API keys

This commit is contained in:
2011-07-19 12:55:59 +01:00
parent fd8e8792db
commit f2b1954291
3 changed files with 8 additions and 2 deletions

View File

@@ -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