|
@@ -720,6 +720,23 @@ class DocumentSegment(db.Model): # type: ignore[name-defined]
|
|
|
else:
|
|
|
return []
|
|
|
|
|
|
+ def get_child_chunks(self):
|
|
|
+ process_rule = self.document.dataset_process_rule
|
|
|
+ if process_rule.mode == "hierarchical":
|
|
|
+ rules = Rule(**process_rule.rules_dict)
|
|
|
+ if rules.parent_mode:
|
|
|
+ child_chunks = (
|
|
|
+ db.session.query(ChildChunk)
|
|
|
+ .filter(ChildChunk.segment_id == self.id)
|
|
|
+ .order_by(ChildChunk.position.asc())
|
|
|
+ .all()
|
|
|
+ )
|
|
|
+ return child_chunks or []
|
|
|
+ else:
|
|
|
+ return []
|
|
|
+ else:
|
|
|
+ return []
|
|
|
+
|
|
|
@property
|
|
|
def sign_content(self):
|
|
|
return self.get_sign_content()
|