mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-30 16:08:14 +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:
|
if len(node.childNodes) == 1:
|
||||||
values[node.tagName] = node.childNodes[0].nodeValue
|
values[node.tagName] = node.childNodes[0].nodeValue
|
||||||
else:
|
else:
|
||||||
if node.tagName == "rowset":
|
|
||||||
continue
|
|
||||||
nv = {}
|
nv = {}
|
||||||
for nd in node.childNodes:
|
if node.tagName == "rowset":
|
||||||
if nd.nodeType == 1:
|
rset = []
|
||||||
nv[nd.tagName] = nd.childNodes[0].nodeValue
|
for nd in node.childNodes:
|
||||||
values[node.tagName] = nv
|
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.
|
# Get this first, as it's safe.
|
||||||
corporation_id = values['corporationID']
|
corporation_id = values['corporationID']
|
||||||
@@ -146,6 +154,11 @@ def import_eve_character(api_key, user_id, character_id):
|
|||||||
|
|
||||||
pchar.race = API_RACES[values['race']]
|
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.api_last_updated = datetime.utcnow()
|
||||||
pchar.save()
|
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_charisma = models.IntegerField("Charisma", blank=True, null=True)
|
||||||
attrib_perception = models.IntegerField("Perception", blank=True, null=True)
|
attrib_perception = models.IntegerField("Perception", blank=True, null=True)
|
||||||
attrib_willpower = models.IntegerField("Willpower", 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()
|
objects = EVEPlayerCharacterManager()
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
{% for acc in eveacc %}
|
{% for acc in eveacc %}
|
||||||
{% for char in acc.characters.all %}
|
{% 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 %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<li>Race: {{ character.race_description }}</li>
|
<li>Race: {{ character.race_description }}</li>
|
||||||
<li>Gender: {{ character.gender_description }}</li>
|
<li>Gender: {{ character.gender_description }}</li>
|
||||||
<li>Corporation: {{ character.corporation.name }}</li>
|
<li>Corporation: {{ character.corporation.name }}</li>
|
||||||
|
<li>Total SP: {{ character.total_sp }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
Reference in New Issue
Block a user