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