@@ -151,26 +151,21 @@ var Task = function(){
151
151
steps = [ ] ;
152
152
index = 0 ;
153
153
154
- return dbTask
155
- . save ( )
156
- . then ( function ( _task ) {
157
- _task . steps . forEach ( function ( step ) {
158
- chain = chain . then ( function ( ) {
159
- return getResolveFunc ( step ) ( step , _task ) ;
160
- } ) ;
154
+ return dbTask . save ( ) . then ( function ( _task ) {
155
+ _task . steps . forEach ( function ( step ) {
156
+ chain = chain . then ( function ( ) {
157
+ return getResolveFunc ( step ) ( step , _task ) ;
161
158
} ) ;
159
+ } ) ;
162
160
163
- return chain
164
- . then ( function ( ) {
165
- return _task . remove ( ) ;
166
- } )
167
- . catch ( function ( err ) {
168
- return Roller . rollOne ( _task )
169
- . then ( function ( ) {
170
- throw err ;
171
- } ) ;
172
- } ) ;
161
+ return chain . then ( function ( ) {
162
+ return _task . remove ( ) ;
163
+ } ) . catch ( function ( err ) {
164
+ return Roller . rollOne ( _task ) . then ( function ( ) {
165
+ throw err ;
166
+ } ) ;
173
167
} ) ;
168
+ } ) ;
174
169
} ;
175
170
} ;
176
171
@@ -214,31 +209,25 @@ function performSave(save, task){
214
209
task . steps [ save . index ] . dataStore = dataStore ;
215
210
task . steps [ save . index ] . markModified ( "dataStore" ) ;
216
211
217
- return updateState ( task , save . index , PENDING )
218
- . then ( function ( _task ) {
219
- return doc . save ( )
220
- . then ( function ( ) {
221
- return updateState ( _task , save . index , DONE ) ;
222
- } ) ;
212
+ return updateState ( task , save . index , PENDING ) . then ( function ( _task ) {
213
+ return doc . save ( ) . then ( function ( ) {
214
+ return updateState ( _task , save . index , DONE ) ;
223
215
} ) ;
216
+ } ) ;
224
217
}
225
218
226
219
function performRemove ( remove , task ) {
227
220
var Collection = getModel ( remove . name ) ;
228
221
229
222
handle$Token ( remove . condition , true ) ;
230
223
231
- return storeOldData ( remove , task )
232
- . then ( function ( ) {
233
- return updateState ( task , remove . index , PENDING )
234
- . then ( function ( _task ) {
235
- return Collection . remove ( remove . condition )
236
- . exec ( )
237
- . then ( function ( ) {
238
- return updateState ( _task , remove . index , DONE ) ;
239
- } ) ;
240
- } ) ;
224
+ return storeOldData ( remove , task ) . then ( function ( ) {
225
+ return updateState ( task , remove . index , PENDING ) . then ( function ( _task ) {
226
+ return Collection . remove ( remove . condition ) . exec ( ) . then ( function ( ) {
227
+ return updateState ( _task , remove . index , DONE ) ;
228
+ } ) ;
241
229
} ) ;
230
+ } ) ;
242
231
}
243
232
244
233
function storeOldData ( step , task ) {
0 commit comments