Keep name on group, create displayName property to point to translated version

This commit is contained in:
blitzmann
2020-06-28 00:54:51 -04:00
parent 2fd4168ab7
commit 4a6a3fc6ea
7 changed files with 9 additions and 8 deletions

View File

@@ -26,7 +26,7 @@ import eos.config
groups_table = Table("invgroups", gamedata_meta,
Column("groupID", Integer, primary_key=True),
*[Column("groupName{}".format(lang), String) for lang in eos.config.translation_mapping.values()],
*[Column("name{}".format(lang), String) for lang in eos.config.translation_mapping.values()],
# Column("description", String), # deprecated
Column("published", Boolean),
Column("categoryID", Integer, ForeignKey("invcategories.categoryID")),
@@ -36,6 +36,6 @@ mapper(Group, groups_table,
properties={
"category" : relation(Category, backref=backref("groups", cascade="all,delete")),
"ID" : synonym("groupID"),
"name" : synonym("groupName{}".format(eos.config.lang)),
"displayName" : synonym("name{}".format(eos.config.lang)),
# "description": deferred(groups_table.c.description) # deprecated
})

View File

@@ -205,7 +205,7 @@ def getGroup(lookfor, eager=None):
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.ID == id).first()
else:
# Group names are unique, so we can use first() instead of one()
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.groupName == lookfor).first()
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.name == lookfor).first()
if group is not None:
groupNameMap[lookfor] = group.ID
else:

View File

@@ -91,7 +91,7 @@ class Booster(HandledItem, ItemAttrShortcut):
@property
def isInvalid(self):
return self.__item is None or self.__item.group.groupName != "Booster"
return self.__item is None or self.__item.group.name != "Booster"
@property
def slot(self):