From 66140f092b1a3273a4ef29cdb2b17467b246e1b1 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Thu, 25 Jun 2020 00:40:29 -0400 Subject: [PATCH] More tweaks to dynamically generate the columns, and a fix for attribute display names --- db_update.py | 8 +++++--- eos/db/gamedata/attribute.py | 7 +++---- eos/db/gamedata/group.py | 3 +-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db_update.py b/db_update.py index f49a74bbd..9c44e4d6c 100644 --- a/db_update.py +++ b/db_update.py @@ -156,7 +156,8 @@ def update_db(): def processEveGroups(): print('processing evegroups') data = _readData('fsd_lite', 'evegroups', keyIdName='groupID') - _addRows(data, eos.gamedata.Group, fieldMap={'groupName_en-us': 'groupName'}) + map = {'groupName_en-us': 'groupName'} + _addRows(data, eos.gamedata.Group, fieldMap=map) return data def processEveCategories(): @@ -169,10 +170,11 @@ def update_db(): def processDogmaAttributes(): print('processing dogmaattributes') data = _readData('fsd_binary', 'dogmaattributes', keyIdName='attributeID') - _addRows(data, eos.gamedata.AttributeInfo, fieldMap={ + map = { 'displayName_en-us': 'displayName', 'tooltipDescription_en-us': 'tooltipDescription' - }) + } + _addRows(data, eos.gamedata.AttributeInfo, fieldMap=map) def processDogmaTypeAttributes(eveTypesData): print('processing dogmatypeattributes') diff --git a/eos/db/gamedata/attribute.py b/eos/db/gamedata/attribute.py index 8ce6fe015..1d7a57fc7 100644 --- a/eos/db/gamedata/attribute.py +++ b/eos/db/gamedata/attribute.py @@ -23,7 +23,7 @@ from sqlalchemy.orm import relation, mapper, synonym, deferred from eos.db import gamedata_meta from eos.gamedata import Attribute, AttributeInfo, Unit - +import eos.config typeattributes_table = Table("dgmtypeattribs", gamedata_meta, Column("value", Float), Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True, index=True), @@ -36,8 +36,7 @@ attributes_table = Table("dgmattribs", gamedata_meta, Column("maxAttributeID", Integer, ForeignKey("dgmattribs.attributeID")), Column("description", Unicode), Column("published", Boolean), - Column("displayName", String), - Column("displayName_zh", String), + *[Column("displayName{}".format(lang), String) for lang in eos.config.translation_mapping.values()], Column("highIsGood", Boolean), Column("iconID", Integer), Column("attributeCategory", Integer), @@ -59,7 +58,7 @@ Attribute.ID = association_proxy("info", "attributeID") Attribute.name = association_proxy("info", "attributeName") Attribute.description = association_proxy("info", "description") Attribute.published = association_proxy("info", "published") -Attribute.displayName = association_proxy("info", "displayName") +Attribute.displayName = association_proxy("info", "displayName{}".format(eos.config.lang)) # todo: this will probably have to be updated... maybe? Attribute.highIsGood = association_proxy("info", "highIsGood") Attribute.iconID = association_proxy("info", "iconID") Attribute.icon = association_proxy("info", "icon") diff --git a/eos/db/gamedata/group.py b/eos/db/gamedata/group.py index fd00e44a5..6a25f587e 100644 --- a/eos/db/gamedata/group.py +++ b/eos/db/gamedata/group.py @@ -26,8 +26,7 @@ import eos.config groups_table = Table("invgroups", gamedata_meta, Column("groupID", Integer, primary_key=True), - Column("groupName", String), - Column("groupName_zh", String), + *[Column("groupName{}".format(lang), String) for lang in eos.config.translation_mapping.values()], Column("description", String), # deprecated Column("published", Boolean), Column("categoryID", Integer, ForeignKey("invcategories.categoryID")),