Move SSD resolved label mutation to typed Kotlin
ober
b5ef6978faeb1cad57a9178c43416fd5ccfc90bc
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -564,6 +564,7 @@ ssdSessionFindCellById ssdSessionCellsByIds ssdSessionBBoxForCellIds ssdSessionRecomputeGroup ssdSessionApproveGroup ssdSessionAppendAreaToGroup + ssdGroupApplyResolvedLabel ssdSessionSuppressGroupAsDeleted appendUniqueCellIdsToGroup ssdSessionAddDetectedCellsInsideArea ssdSessionAddOcrWords @@ -1050,6 +1051,13 @@ (SsdGroup-status-set! group "reviewed") (SsdGroup-notes-set! group "Appended on Android") added))) + (def (ssdGroupApplyResolvedLabel (group : SsdGroup) + (label : String)) : Bool + (if (not (string-blank? label)) + (begin + (SsdGroup-label-set! group label) + #t) + #f)) (def (ssdSessionSuppressGroupAsDeleted (session : SsdSession) (group : SsdGroup)) : Unit (begin @@ -6863,9 +6871,7 @@ " private fun finalizeGroupLabel(group: SsdGroup) {" " val typeDisplay = BoxTypes.display(this, group.boxTypeId)" " val resolved = resolvedLabelForBoxTypeAndroid(this, group.label, typeDisplay, group.boxTypeId)" - " if (hasResolvedLabel(resolved)) {" - " group.label = resolved" - " }" + " ssdGroupApplyResolvedLabel(group, resolved)" " }" "" " private fun focusBoxTypeDropdown(dialog: AlertDialog, boxType: AutoCompleteTextView) {"