|
|
@ -128,13 +128,12 @@ function patchBuggyResponses(response){ |
|
|
|
// replacements to only records with BOTH a matching 'value' and a matching 'label.from'.
|
|
|
|
// replacements to only records with BOTH a matching 'value' and a matching 'label.from'.
|
|
|
|
if( response.length === 1 ){ |
|
|
|
if( response.length === 1 ){ |
|
|
|
let first = response[0]; |
|
|
|
let first = response[0]; |
|
|
|
for( var ii=0; ii<RECAST_LABELS.length; ii++ ){ |
|
|
|
RECAST_LABELS.forEach(recast => { |
|
|
|
let recast = RECAST_LABELS[ii]; |
|
|
|
if( !_.has(recast, 'label') || !_.has(recast.label, 'to') ){ return; } |
|
|
|
if( !recast.hasOwnProperty('label') || !recast.label.hasOwnProperty('to') ){ continue; } |
|
|
|
if( recast.value !== first.value ){ return; } |
|
|
|
if( recast.value !== first.value ){ continue; } |
|
|
|
if( _.has(recast.label, 'from') && recast.label.from !== first.label ){ return; } |
|
|
|
if( recast.label.hasOwnProperty('from') && recast.label.from !== first.label ){ continue; } |
|
|
|
first.label = recast.label.to; |
|
|
|
response[0].label = recast.label.to; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// known bug where the street name is only a directional, in this case we will merge it
|
|
|
|
// known bug where the street name is only a directional, in this case we will merge it
|
|
|
|