From e61ffa652e4a64ed27e3e566fc72e5366474d865 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 16 Feb 2022 00:10:43 +0100 Subject: [PATCH] Performance optimizations --- Layout/default/Linework/Index.php | 19 +++++++++++++++- application/Termination/Termination.php | 27 ++++++++++++++++------- application/Workflowitem/Workflowitem.php | 4 +++- lib/FronkDB/FronkDB.php | 7 ++++++ 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/Layout/default/Linework/Index.php b/Layout/default/Linework/Index.php index 8c6912652..b6d9ce981 100644 --- a/Layout/default/Linework/Index.php +++ b/Layout/default/Linework/Index.php @@ -146,6 +146,8 @@ Kundenkabel Spleiß Netz Spleiß Kunde + FTU + FTU verlegt Fertig Kundenkabel Spleiß Netz Spleiß Kunde + FTU + FTU verlegt Fertig @@ -190,6 +194,17 @@ getWorkflowvalue('customer_cable_injected') != "1") ? "" : "" ?> getWorkflowvalue('spliced_network') != "1") ? "" : "" ?> getWorkflowvalue('spliced_customer') != "1") ? "" : "" ?> + + getWorkflowvalue('abschlusstyp') == "SC/APC in FTU" && empty($term->getWorkflowvalue('ist_abschlusstyp'))) || $term->getWorkflowvalue('ist_abschlusstyp') == "SC/APC in FTU"): ?> + getWorkflowvalue('inhouse_cabling_supplied') != "1") ? "" : "" ?> + + + + getWorkflowvalue('abschlusstyp') == "SC/APC in FTU" && empty($term->getWorkflowvalue('ist_abschlusstyp'))) || $term->getWorkflowvalue('ist_abschlusstyp') == "SC/APC in FTU"): ?> + getWorkflowvalue('inhouse_cabling_deployed') != "1") ? "" : "" ?> + + + getWorkflowvalue('customer_passive_finished') != "1") ? "" : "" ?> hidden"> @@ -242,7 +257,7 @@ Nicht fertiggestellt. - + "> @@ -377,6 +392,8 @@ + + diff --git a/application/Termination/Termination.php b/application/Termination/Termination.php index 58f00cd76..11fee084f 100644 --- a/application/Termination/Termination.php +++ b/application/Termination/Termination.php @@ -37,14 +37,25 @@ class Termination extends mfBaseModel { public function loadWorkflowItems() { $item_ids = []; - foreach(WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]) as $item) { + + $term_wfitems = mfValuecache::singleton()->get("wfitems-term-active"); + if(!$term_wfitems) { + $term_wfitems = WorkflowitemModel::search(["object_type" => "Termination", "active" => 1]); + mfValuecache::singleton()->set("wfitems-term-active", $term_wfitems); + } + + foreach($term_wfitems as $item) { $item->setObjectId($this->id); $this->workflowitems[$item->name] = $item; - //mfValuecache::set("wfTerm-name-".$item->name, $item); - //mfValuecache::set("wfTerm-id-".$item->id, $item); + mfValuecache::singleton()->set("wfTerm-name-".$item->name, $item); + mfValuecache::singleton()->set("wfTerm-id-".$item->id, $item); $item_ids[] = $item->id; } + foreach($item_ids as $id) { + mfValuecache::singleton()->set("wfItemvalue-item-".$id."-object-".$this->id, new Workflowvalue()); + } + // get values $values = WorkflowvalueModel::search(["object_id" => $this->id]); //var_dump($values);exit; @@ -52,13 +63,13 @@ class Termination extends mfBaseModel { if(array_key_exists($value->item->name, $this->workflowitems)) { //var_dump($value);exit; $this->workflowitems[$value->item->name]->setValue($value); - mfValuecache::singleton()->set("wfTerm-name-".$this->workflowitems[$value->item->name]->name, $this->workflowitems[$value->item->name]); - mfValuecache::singleton()->set("wfTerm-id-".$this->workflowitems[$value->item->name]->id, $this->workflowitems[$value->item->name]); - mfValuecache::singleton()->set("wfItemvalue-item-".$value->item_id."-object-".$value->object_id, $value); + mfValuecache::singleton()->set("wfItemvalue-item-".$value->item_id."-object-".$this->id, $value); } } - - //var_dump(array_keys(mfValuecache::singleton()->getCache())); + /*if($this->id == 42) { + //var_dump(array_keys(mfValuecache::singleton()->getCache()));exit; + var_dump(mfValuecache::singleton()->get("wfItemvalue-item-20-object-42"));exit; + }*/ } diff --git a/application/Workflowitem/Workflowitem.php b/application/Workflowitem/Workflowitem.php index a5b13bab3..f9d73b053 100644 --- a/application/Workflowitem/Workflowitem.php +++ b/application/Workflowitem/Workflowitem.php @@ -30,12 +30,14 @@ class Workflowitem extends mfBaseModel { return $value; } $value = WorkflowvalueModel::getFirst(['item_id' => $this->id, "object_id" => $this->object_id]); + // explicitly cache empty value + mfValuecache::singleton()->set("wfItemvalue-item-".$this->id."-object-".$this->object_id, $value); if(!$value) { $vdata['item_id'] = $this->id; $vdata['object_id'] = $this->object_id; $value = WorkflowvalueModel::create($vdata); + } - mfValuecache::singleton()->set("wfItemvalue-item-".$this->id."-object-".$this->object_id, $value); $this->value = $value; return $this->value; } diff --git a/lib/FronkDB/FronkDB.php b/lib/FronkDB/FronkDB.php index 858a871fd..891d874ee 100644 --- a/lib/FronkDB/FronkDB.php +++ b/lib/FronkDB/FronkDB.php @@ -62,7 +62,14 @@ class FronkDB { } if(FRONKDB_SQLDEBUG==true) { + /*$this->log->debug("[FronkDB] ================"); + $this->log->debug("[FronkDB] START SQL QUERY"); + $bt = debug_backtrace(); + foreach($bt as $n => $b) { + $this->log->debug($n.") ".$b["file"]."(".$b['line']."): ".$b['class']."->".$b['function']."()" ); + }*/ $this->log->debug("[FronkDB] $sql"); + //$this->log->debug("[FronkDB] END SQL QUERY"); //echo "$sql\n"; }
AP-TypKundenkabel Spleiß Netz Spleiß KundeFTUFTU verlegt Fertig