changed to @exampleId

This commit is contained in:
Luka Kavčič 2021-04-08 09:11:57 +02:00
parent 208f5b0ee8
commit e496d3ef01
2 changed files with 7 additions and 2 deletions

View File

@ -269,7 +269,7 @@ class SkeInsert(DataChgClickMessage):
def _as_corpus_example(self, example): def _as_corpus_example(self, example):
new_example = Example() new_example = Example()
new_example.inner = CorpusExample() new_example.inner = CorpusExample()
new_example.inner.other_attributes["example_id"] = example.s_id new_example.inner.other_attributes["exampleId"] = example.s_id
new_example.inner.cluster = ExampleClusters.first_empty_cluster() new_example.inner.cluster = ExampleClusters.first_empty_cluster()
lex_left = ComponentLexeme() lex_left = ComponentLexeme()

View File

@ -5,10 +5,15 @@ class CorpusExample:
self.other_attributes = {} self.other_attributes = {}
def import_xml(self, example_xml): def import_xml(self, example_xml):
for oth_attr in ["example_id", "modified", "lexical_unit_id", "audio"]: for oth_attr in ["exampleId", "modified", "lexical_unit_id", "audio"]:
if example_xml.hasAttribute(oth_attr): if example_xml.hasAttribute(oth_attr):
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr) self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
# this is a quick fix. when all data has been updated from @example_id to @exampleId, you can remove this
if oth_attr is "exampleId":
if example_xml.hasAttribute("example_id"):
self.other_attributes[oth_attr] = example_xml.getAttribute("example_id")
def export(self, doc, modified): def export(self, doc, modified):
result = doc.createElement("corpusExample") result = doc.createElement("corpusExample")
if modified: if modified: