Class ::nsmcp::QuestionBackend (public)
::nx::Class ::nsmcp::QuestionBackend
Defined in /usr/local/ns/tcl/nsmcp/question-backend.tcl
Remove only the text block that duplicates structuredContent. Preserve errors, explanatory text and non-text content for both model and inspector.
- Testcases:
- No testcase defined.
Source code: :public method canonicalResult {json} { if {[catch {ns_json parse -output triples -- $json} root] || [lindex $root 1] ne "object"} {return $json} if {[catch {ns_json triples gettype -path structuredContent -- $root}]} {return $json} set structured [list {} [ns_json triples gettype -path structuredContent -- $root] [ns_json triples getvalue -output triples -path structuredContent -- $root]] set duplicate [ns_json value -- $structured] set fields {} foreach {key type value} [lindex $root 2] { if {$key eq "content" && $type eq "array"} { set content {} set index 0 foreach {i kind members} $value { set omit false if {$kind eq "object"} { set item [ns_json parse [ns_json value -- [list {} object $members]]] if {[dict exists $item type] && [dict get $item type] eq "text" && [dict exists $item text] && [dict get $item text] eq $duplicate} {set omit true} } if {!$omit} {lappend content $index $kind $members; incr index} } set value $content } lappend fields $key $type $value } return [ns_json value -- [list {} object $fields]] } :public method describe {} {return {backend unknown}} :public method run {question state emit} {error "abstract QuestionBackend.run"}XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)