diff --git a/eve_api/api_puller/accounts.py b/eve_api/api_puller/accounts.py index c95ec37..9a26bb8 100755 --- a/eve_api/api_puller/accounts.py +++ b/eve_api/api_puller/accounts.py @@ -110,13 +110,21 @@ def import_eve_character(api_key, user_id, character_id): if len(node.childNodes) == 1: values[node.tagName] = node.childNodes[0].nodeValue else: - if node.tagName == "rowset": - continue nv = {} - for nd in node.childNodes: - if nd.nodeType == 1: - nv[nd.tagName] = nd.childNodes[0].nodeValue - values[node.tagName] = nv + if node.tagName == "rowset": + rset = [] + for nd in node.childNodes: + if nd.nodeType == 1: + d = {} + for e in nd.attributes.keys(): + d[e] = nd.attributes[e].value + rset.append(d) + values[node.attributes['name'].value] = rset + else: + for nd in node.childNodes: + if nd.nodeType == 1: + nv[nd.tagName] = nd.childNodes[0].nodeValue + values[node.tagName] = nv # Get this first, as it's safe. corporation_id = values['corporationID'] @@ -146,6 +154,11 @@ def import_eve_character(api_key, user_id, character_id): pchar.race = API_RACES[values['race']] + total = 0 + for skill in values['skills']: + total = total + int(skill['skillpoints']) + pchar.total_sp = total + pchar.api_last_updated = datetime.utcnow() pchar.save() diff --git a/eve_api/evolutions/__init__.py b/eve_api/evolutions/__init__.py index 0fdfe86..788a555 100644 --- a/eve_api/evolutions/__init__.py +++ b/eve_api/evolutions/__init__.py @@ -1 +1 @@ -SEQUENCE = ['applications-field'] +SEQUENCE = ['applications-field', 'total-sp'] diff --git a/eve_api/evolutions/total-sp.py b/eve_api/evolutions/total-sp.py new file mode 100644 index 0000000..8f1b5f1 --- /dev/null +++ b/eve_api/evolutions/total-sp.py @@ -0,0 +1,7 @@ +from django_evolution.mutations import * +from django.db import models + +MUTATIONS = [ + AddField('EVEPlayerCharacter', 'total_sp', models.IntegerField, initial=0) +] + diff --git a/eve_api/models/api_player.py b/eve_api/models/api_player.py index 5037a8a..3f62788 100644 --- a/eve_api/models/api_player.py +++ b/eve_api/models/api_player.py @@ -73,6 +73,8 @@ class EVEPlayerCharacter(EVEAPIModel): attrib_charisma = models.IntegerField("Charisma", blank=True, null=True) attrib_perception = models.IntegerField("Perception", blank=True, null=True) attrib_willpower = models.IntegerField("Willpower", blank=True, null=True) + + total_sp = models.IntegerField("Total SP", blank=True, null=True) objects = EVEPlayerCharacterManager() diff --git a/templates/hr/applications/view.html b/templates/hr/applications/view.html index 63f4541..17bc8c8 100644 --- a/templates/hr/applications/view.html +++ b/templates/hr/applications/view.html @@ -34,7 +34,7 @@ diff --git a/templates/sso/character.html b/templates/sso/character.html index 0a3949e..7c37f30 100644 --- a/templates/sso/character.html +++ b/templates/sso/character.html @@ -10,6 +10,7 @@
  • Race: {{ character.race_description }}
  • Gender: {{ character.gender_description }}
  • Corporation: {{ character.corporation.name }}
  • +
  • Total SP: {{ character.total_sp }}