Improved performance in findAddress
This commit is contained in:
@@ -342,10 +342,13 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
|
||||
if($this->db()->num_rows($res)) {
|
||||
if($format == "flat") {
|
||||
$unit_counts = [];
|
||||
while($data = $this->db()->fetch_object($res)) {
|
||||
// get unit count
|
||||
$unit_count = ADBWohneinheitModel::count(['hausnummer_id' => $data->hausnummer_id]);
|
||||
|
||||
if(!array_key_exists($data->hausnummer_id, $unit_counts)) {
|
||||
$unit_counts[$data->hausnummer_id] = ADBWohneinheitModel::count(['hausnummer_id' => $data->hausnummer_id]);
|
||||
}
|
||||
|
||||
// get allowed preorderTypes
|
||||
$ptypes = [];
|
||||
if($data->freigabe) {
|
||||
@@ -376,7 +379,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
'street' => $data->strasse,
|
||||
'housenumber' => $housenumber,
|
||||
'lot_number' => $data->grund_nr,
|
||||
'building_unit_count' => (int)$unit_count,
|
||||
'building_unit_count' => (int)$unit_counts[$data->hausnummer_id],
|
||||
'num' => (int)$data->num,
|
||||
'block' => $data->block,
|
||||
'stock' => $data->stock,
|
||||
|
||||
@@ -6,6 +6,7 @@ class PreorderModel {
|
||||
public $preordercampaign_id;
|
||||
public $adb_hausnummer_id;
|
||||
public $adb_wohneinheit_id;
|
||||
public $oaid;
|
||||
public $address_district;
|
||||
public $address_info;
|
||||
public $building_id;
|
||||
@@ -42,10 +43,13 @@ class PreorderModel {
|
||||
public $city;
|
||||
public $phone;
|
||||
public $email;
|
||||
public $shipping_address;
|
||||
public $addon_services;
|
||||
public $addon_data;
|
||||
public $submit_type;
|
||||
public $submit_request;
|
||||
public $deleted;
|
||||
public $deleted_by;
|
||||
|
||||
public $note;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user