Fix restaurant distance sorting to use numeric comparison
CFML compare() does string comparison, causing distances like 1.9 to sort after 12.3. Switched to numeric < > operators. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8adac1a242
commit
eda8010927
1 changed files with 3 additions and 1 deletions
|
|
@ -91,7 +91,9 @@ try {
|
|||
// Sort by distance if user location provided
|
||||
if (hasUserLocation) {
|
||||
arraySort(rows, function(a, b) {
|
||||
return compare(a.DistanceMiles, b.DistanceMiles);
|
||||
if (a.DistanceMiles < b.DistanceMiles) return -1;
|
||||
if (a.DistanceMiles > b.DistanceMiles) return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue