summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-07 20:32:38 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-07 20:32:38 +0200
commit15dfc83ea4504c74fdf18e3c036e2b392f3a9352 (patch)
tree795c95a996d79897f89040fb3843316662d7928d
parentba36fe1db61a527dab5d41add08676c3082a6f3e (diff)
downloadanalyzer-15dfc83ea4504c74fdf18e3c036e2b392f3a9352.tar.gz
analyzer-15dfc83ea4504c74fdf18e3c036e2b392f3a9352.zip
update for new schema
-rw-r--r--worker.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/worker.py b/worker.py
index f8461e9..a1ab696 100644
--- a/worker.py
+++ b/worker.py
@@ -64,10 +64,10 @@ def connect():
Participant.player = relationship(
"player", foreign_keys="player.api_id",
primaryjoin="and_(player.api_id == participant.player_api_id)")
- ParticipantExt = Base.classes.participant_ext
- Participant.participant_ext = relationship(
- "participant_ext", foreign_keys="participant_ext.participant_api_id",
- primaryjoin="and_(participant_ext.participant_api_id == participant.api_id)")
+ ParticipantExt = Base.classes.participant_stats
+ Participant.participant_stats = relationship(
+ "participant_stats", foreign_keys="participant_stats.participant_api_id",
+ primaryjoin="and_(participant_stats.participant_api_id == participant.api_id)")
Player = Base.classes.player
db = Session(engine)
@@ -111,8 +111,8 @@ class Model(object):
table, column = path.split(".")
if table == "participant":
return vars(record)[column]
- if table == "participant_ext":
- return vars(record.participant_ext[0])[column]
+ if table == "participant_stats":
+ return vars(record.participant_stats[0])[column]
if table == "player":
return vars(record.player[0])[column]
if table == "roster":
@@ -181,7 +181,7 @@ class MVPScoreModel(Model):
def __init__(self, db):
self.features = ["participant.kills", "participant.deaths",
"participant.assists"]
- self.label = "participant_ext.rating"
+ self.label = "participant_stats.impact_score"
self.type = "linear"
self.batches = 1
self.batchsize = 500
@@ -221,14 +221,14 @@ def process():
with db.no_autoflush:
for c in range(len(ratings)):
rating = float(ratings[c])
- pext = db.query(ParticipantExt).filter(
+ pstat = db.query(ParticipantExt).filter(
ParticipantExt.participant_api_id == ids[c]).first()
# manual upsert
- if pext is None:
+ if pstat is None:
db.add(ParticipantExt(participant_api_id=ids[c],
score=rating))
else:
- pext.score = rating
+ pstat.score = rating
db.commit()
# ack all until this one