@@ -120,23 +120,25 @@ def write_to_todolist_file(self, **kwargs):
120
120
# print(kwargs['action'], kwargs['indices'])
121
121
if kwargs ['action' ] == 'delete_element' and len (kwargs ['indices' ]) == 1 :
122
122
json_data ['data' ].pop (kwargs ['indices' ][0 ])
123
+ print ('what???????' )
124
+ else :
123
125
124
- current_element = json_data ['data' ][kwargs ['indices' ][- 1 ]]
125
- for i in range (len (kwargs ['indices' ])- 1 ):
126
- if isinstance (current_element [0 ], list ):
127
- current_element = current_element [1 ]
126
+ current_element = json_data ['data' ][kwargs ['indices' ][- 1 ]]
127
+ for i in range (len (kwargs ['indices' ])- 1 ):
128
+ if isinstance (current_element [0 ], list ):
129
+ current_element = current_element [1 ]
128
130
129
- # print(kwargs['action'], current_element, kwargs['indices'], list(reversed(kwargs['indices'][:-1])), i)
130
- if kwargs ['action' ] == 'delete_element' and i == len (kwargs ['indices' ]) - 2 :
131
- current_element .pop (list (reversed (kwargs ['indices' ][:- 1 ]))[i ])
132
- break
131
+ # print(kwargs['action'], current_element, kwargs['indices'], list(reversed(kwargs['indices'][:-1])), i)
132
+ if kwargs ['action' ] == 'delete_element' and i == len (kwargs ['indices' ]) - 2 :
133
+ current_element .pop (list (reversed (kwargs ['indices' ][:- 1 ]))[i ])
134
+ break
133
135
134
- current_element = current_element [list (reversed (kwargs ['indices' ][:- 1 ]))[i ]]
136
+ current_element = current_element [list (reversed (kwargs ['indices' ][:- 1 ]))[i ]]
135
137
136
- if kwargs ['action' ] == 'toggle_task' :
137
- current_element [1 ] = kwargs ['value' ]
138
- elif kwargs ['action' ] == 'toggle_section' :
139
- current_element [0 ][1 ] = kwargs ['value' ]
138
+ if kwargs ['action' ] == 'toggle_task' :
139
+ current_element [1 ] = kwargs ['value' ]
140
+ elif kwargs ['action' ] == 'toggle_section' :
141
+ current_element [0 ][1 ] = kwargs ['value' ]
140
142
141
143
142
144
0 commit comments