@@ -94,6 +94,7 @@ pub struct ExecutionCheckbox {
9494 pub text : String ,
9595 pub initial_checked : bool ,
9696 pub checked : bool ,
97+ pub nesting_level : u32 ,
9798 pub toggled_at : Option < DateTime < Utc > > ,
9899}
99100
@@ -519,13 +520,19 @@ impl ExecutionState {
519520 . content
520521 . iter ( )
521522 . map ( |item| match item {
522- StepContent :: Checkbox { text, checked, .. } => {
523+ StepContent :: Checkbox {
524+ text,
525+ checked,
526+ nesting_level,
527+ ..
528+ } => {
523529 let id = format ! ( "{step_id}/cb-{cb_index}" ) ;
524530 cb_index += 1 ;
525531 StepContent :: Checkbox {
526532 id : Some ( id) ,
527533 text : text. clone ( ) ,
528534 checked : * checked,
535+ nesting_level : * nesting_level,
529536 }
530537 }
531538 // InputDefinition already has its own `id` from the template YAML.
@@ -1059,7 +1066,12 @@ fn execution_content_with_checkbox_ids(
10591066 . iter ( )
10601067 . map ( |item| match item {
10611068 StepContent :: Prose { text } => ExecutionStepContent :: Prose { text : text. clone ( ) } ,
1062- StepContent :: Checkbox { id, text, checked } => {
1069+ StepContent :: Checkbox {
1070+ id,
1071+ text,
1072+ checked,
1073+ nesting_level,
1074+ } => {
10631075 let id = id. clone ( ) . unwrap_or_else ( || {
10641076 loop {
10651077 let candidate = format ! ( "{step_id}/cb-{checkbox_index}" ) ;
@@ -1074,6 +1086,7 @@ fn execution_content_with_checkbox_ids(
10741086 text : text. clone ( ) ,
10751087 initial_checked : * checked,
10761088 checked : * checked,
1089+ nesting_level : nesting_level. unwrap_or_default ( ) ,
10771090 toggled_at : None ,
10781091 } )
10791092 }
@@ -1275,6 +1288,7 @@ mod tests {
12751288 id: None ,
12761289 text: "Ready" . to_string( ) ,
12771290 checked: false ,
1291+ nesting_level: None ,
12781292 } ] ,
12791293 } ,
12801294 Step {
@@ -1816,6 +1830,7 @@ mod tests {
18161830 id: None ,
18171831 text: "Already verified by setup" . to_string( ) ,
18181832 checked: true ,
1833+ nesting_level: None ,
18191834 } ] ;
18201835 let mut state = ExecutionState :: new ( ) ;
18211836 state. start ( & template) . unwrap ( ) ;
@@ -1835,6 +1850,7 @@ mod tests {
18351850 id: None ,
18361851 text: "Initially checked" . to_string( ) ,
18371852 checked: true ,
1853+ nesting_level: None ,
18381854 } ] ;
18391855 let mut state = ExecutionState :: new ( ) ;
18401856 state. start ( & template) . unwrap ( ) ;
@@ -1897,6 +1913,7 @@ mod tests {
18971913 id: None ,
18981914 text: "Dynamic check" . to_string( ) ,
18991915 checked: false ,
1916+ nesting_level: None ,
19001917 } ] ,
19011918 Some ( "step-1" ) ,
19021919 )
0 commit comments