Skip to content
Snippets Groups Projects

Handle multiple type reporting for elements and transcriptions

Merged Valentin Rigal requested to merge report-multiple-type-count into master
2 files
+ 40
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -45,13 +45,14 @@ class Reporter(object):
# Just call the element initializer
self._get_element(element_id)
def add_element(self, parent_id, type):
def add_element(self, parent_id, type, type_count=1):
"""
Report creating a single element with a parent.
Multiple elements with the same type and parent can be declared with the type_count parameter.
"""
elements = self._get_element(parent_id)["elements"]
elements.setdefault(type, 0)
elements[type] += 1
elements[type] += type_count
def add_classification(self, element_id, class_name):
"""
@@ -77,13 +78,14 @@ class Reporter(object):
)
element["classifications"] = dict(counter)
def add_transcription(self, element_id, type):
def add_transcription(self, element_id, type, type_count=1):
"""
Report creating a transcription on an element.
Multiple transcriptions with the same type and parent can be declared with the type_count parameter.
"""
transcriptions = self._get_element(element_id)["transcriptions"]
transcriptions.setdefault(type, 0)
transcriptions[type] += 1
transcriptions[type] += type_count
def add_transcriptions(self, element_id, transcriptions):
"""
Loading