mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added Total SP field calculated during API runs
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
SEQUENCE = ['applications-field']
|
||||
SEQUENCE = ['applications-field', 'total-sp']
|
||||
|
||||
7
eve_api/evolutions/total-sp.py
Normal file
7
eve_api/evolutions/total-sp.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django_evolution.mutations import *
|
||||
from django.db import models
|
||||
|
||||
MUTATIONS = [
|
||||
AddField('EVEPlayerCharacter', 'total_sp', models.IntegerField, initial=0)
|
||||
]
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<ul>
|
||||
{% for acc in eveacc %}
|
||||
{% for char in acc.characters.all %}
|
||||
<li><a href="/profile/characters/{{ char.id }}/">{{ char.name }}</a> - {{ char.corporation }} / {{ char.corporation.alliance }} - {{ char.balance }} ISK <button type="button" onclick="CCPEVE.showInfo('1377//{{ char.id }}')">Show In Eve</button></li>
|
||||
<li><a href="/profile/characters/{{ char.id }}/">{{ char.name }}</a> - {{ char.corporation }} / {{ char.corporation.alliance }} - {{ char.balance }} ISK, {{ char.total_sp }} SP <button type="button" onclick="CCPEVE.showInfo('1377//{{ char.id }}')">Show In Eve</button></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<li>Race: {{ character.race_description }}</li>
|
||||
<li>Gender: {{ character.gender_description }}</li>
|
||||
<li>Corporation: {{ character.corporation.name }}</li>
|
||||
<li>Total SP: {{ character.total_sp }}</li>
|
||||
</ul>
|
||||
|
||||
<table>
|
||||
|
||||
Reference in New Issue
Block a user