Line 133:
Line 133:
if sortKey then
if sortKey then
table.sort(collection, function(a, b)
table.sort(collection, function(a, b)
−
if a[sortKey] ~= b[sortKey] then
+
if a[sortKey] and b[sortKey] and a[sortKey] ~= b[sortKey] then
return a[sortKey] < b[sortKey]
return a[sortKey] < b[sortKey]
elseif a._id == b._id then
elseif a._id == b._id then
return a._api_id < b._api_id
return a._api_id < b._api_id
−
else
+
else
return a._id < b._id
return a._id < b._id
end
end
Line 438:
Line 438:
end
end
−
testIterator('shipsByType', { type = '18', sort = '_id' , listBase = true})
+
testIterator('shipsByType', { type = '11', sort = '_class' , listBase = true})
testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})
testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})