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:
John Mizerek 2026-03-02 11:57:45 -08:00
parent 8adac1a242
commit eda8010927

View file

@ -91,7 +91,9 @@ try {
// Sort by distance if user location provided // Sort by distance if user location provided
if (hasUserLocation) { if (hasUserLocation) {
arraySort(rows, function(a, b) { 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;
}); });
} }