Changes

Line 189: Line 189:  
     return Iterator.shipsBy(context, n, function(e)
 
     return Iterator.shipsBy(context, n, function(e)
 
         return type == nil or e._type == type
 
         return type == nil or e._type == type
 +
    end)
 +
end
 +
 +
function Iterator.shipsByTrueId(context, n)
 +
    local from = numberKey('from', context, n, 1)
 +
    local to = numberKey('to', context, n, 500)
 +
    return Iterator.shipsBy(context, n, function(e)
 +
        if e._true_id then
 +
            return e._true_id >= from and e._true_id <= to
 +
        else
 +
            return e._id >= from and e._id <= to
 +
        end
 
     end)
 
     end)
 
end
 
end
Line 440: Line 452:  
     testIterator('shipsByType', { type = '11', sort = '_class' , listBase = true})
 
     testIterator('shipsByType', { type = '11', sort = '_class' , listBase = true})
 
     testIterator('shipsByType', { sort = '_name'})
 
     testIterator('shipsByType', { sort = '_name'})
 +
    testIterator('shipsByTrueId', { sort = '_id', from = '1', to = '20', listBase = true})
 
     testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})
 
     testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})
 
      
 
      
1,032

edits