File tree Expand file tree Collapse file tree 1 file changed +15
-16
lines changed
order-routing/rust/rankers/default/src Expand file tree Collapse file tree 1 file changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -17,26 +17,25 @@ fn function(input: input::ResponseData) -> Result<output::FunctionResult> {
1717 . fulfillment_groups
1818 . iter ( )
1919 . map ( |group| {
20- let fulfillment_group_id = group. id . clone ( ) ;
2120 let rankings = group
2221 . inventory_locations
23- . clone ( )
24- . unwrap ( )
25- . iter ( )
26- . map ( |inventory_location| {
27- let location_id = inventory_location . location . id . clone ( ) ;
28- output :: RankedLocation {
29- location_id ,
30- rank : 0 ,
31- }
22+ . as_ref ( )
23+ . map ( |locations| {
24+ locations
25+ . iter ( )
26+ . map ( |location| output :: RankedLocation {
27+ location_id : location . location . id . clone ( ) ,
28+ rank : 0 ,
29+ } )
30+ . collect ( )
3231 } )
33- . collect ( ) ;
34- let rank_operation = output:: FulfillmentGroupRankedLocations {
35- fulfillment_group_id,
36- rankings,
37- } ;
32+ . unwrap_or_else ( Vec :: new) ;
33+
3834 output:: Operation {
39- rank : rank_operation,
35+ rank : output:: FulfillmentGroupRankedLocations {
36+ fulfillment_group_id : group. id . clone ( ) ,
37+ rankings,
38+ } ,
4039 }
4140 } )
4241 . collect ( ) ;
You can’t perform that action at this time.
0 commit comments