Cleanup logs, fixed add Venta, fixed search
This commit is contained in:
@ -65,7 +65,11 @@ class Search
|
||||
foreach ($queries as $q) {
|
||||
$this->add($results, $this->findVentas($q, $tipo));
|
||||
if (in_array($tipo, $tiposUnidades)) {
|
||||
$this->add($results, $this->findUnidadesDisponibles($q, $tipo), false);
|
||||
$disponibles = $this->findUnidadesDisponibles($q, $tipo);
|
||||
if (count($disponibles) === 0) {
|
||||
continue;
|
||||
}
|
||||
$this->add($results, $disponibles, false);
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
@ -281,11 +285,10 @@ class Search
|
||||
protected function add(array &$results, array $found, bool $is_venta = true): void
|
||||
{
|
||||
foreach ($found as $item) {
|
||||
if (!isset($item['tipo'])) {
|
||||
$item['tipo'] = ($is_venta) ? 'venta' : 'unidad';
|
||||
}
|
||||
if (!$this->inResults($item, $results)) {
|
||||
$item['tipo'] = 'venta';
|
||||
if (!$is_venta) {
|
||||
$item['tipo'] = 'unidad';
|
||||
}
|
||||
$results []= $item;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user