@@ -219,26 +219,20 @@ func (router moveRouter) sendToServiceCounselor(appCtx appcontext.AppContext, mo
219
219
return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
220
220
}
221
221
222
- if verrs , err := appCtx .DB ().ValidateAndUpdate (move .MTOShipments [i ].BoatShipment ); verrs .HasAny () || err != nil {
223
- msg := "failure saving boat shipment when routing move submission"
224
- appCtx .Logger ().Error (msg , zap .Error (err ))
225
- return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
226
- }
227
- }
228
- // update status for mobile home shipment
229
- if move .MTOShipments [i ].ShipmentType == models .MTOShipmentTypeMobileHome {
230
- move .MTOShipments [i ].Status = models .MTOShipmentStatusSubmitted
231
-
232
- if verrs , err := appCtx .DB ().ValidateAndUpdate (& move .MTOShipments [i ]); verrs .HasAny () || err != nil {
233
- msg := "failure saving parent MTO shipment object for mobile home shipment when routing move submission"
234
- appCtx .Logger ().Error (msg , zap .Error (err ))
235
- return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
222
+ if move .MTOShipments [i ].BoatShipment != nil {
223
+ if verrs , err := appCtx .DB ().ValidateAndUpdate (move .MTOShipments [i ].BoatShipment ); verrs .HasAny () || err != nil {
224
+ msg := "failure saving boat shipment when routing move submission"
225
+ appCtx .Logger ().Error (msg , zap .Error (err ))
226
+ return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
227
+ }
236
228
}
237
229
238
- if verrs , err := appCtx .DB ().ValidateAndUpdate (move .MTOShipments [i ].MobileHome ); verrs .HasAny () || err != nil {
239
- msg := "failure saving mobile home shipment when routing move submission"
240
- appCtx .Logger ().Error (msg , zap .Error (err ))
241
- return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
230
+ if move .MTOShipments [i ].MobileHome != nil {
231
+ if verrs , err := appCtx .DB ().ValidateAndUpdate (move .MTOShipments [i ].MobileHome ); verrs .HasAny () || err != nil {
232
+ msg := "failure saving mobile home shipment when routing move submission"
233
+ appCtx .Logger ().Error (msg , zap .Error (err ))
234
+ return apperror .NewInvalidInputError (move .MTOShipments [i ].ID , err , verrs , msg )
235
+ }
242
236
}
243
237
}
244
238
0 commit comments