Performance optimizations

This commit is contained in:
Frank Schubert
2022-02-16 00:10:43 +01:00
parent 8a200da3f0
commit e61ffa652e
4 changed files with 47 additions and 10 deletions

View File

@@ -146,6 +146,8 @@
<th>Kundenkabel</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>FTU</th>
<th>FTU verlegt</th>
<th>Fertig</th>
</tr>
<?php $bcount = 0;
@@ -161,6 +163,8 @@
<th>Kundenkabel</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>FTU</th>
<th>FTU verlegt</th>
<th>Fertig</th>
</tr>
<?php endif ?>
@@ -190,6 +194,17 @@
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('customer_cable_injected') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('spliced_network') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('spliced_customer') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)">
<?php if(($term->getWorkflowvalue('abschlusstyp') == "SC/APC in FTU" && empty($term->getWorkflowvalue('ist_abschlusstyp'))) || $term->getWorkflowvalue('ist_abschlusstyp') == "SC/APC in FTU"): ?>
<?=($term->getWorkflowvalue('inhouse_cabling_supplied') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?>
<?php endif; ?>
</td>
<td onclick="togglePipework(<?=$term->id?>)">
<?php if(($term->getWorkflowvalue('abschlusstyp') == "SC/APC in FTU" && empty($term->getWorkflowvalue('ist_abschlusstyp'))) || $term->getWorkflowvalue('ist_abschlusstyp') == "SC/APC in FTU"): ?>
<?=($term->getWorkflowvalue('inhouse_cabling_deployed') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?>
<?php endif; ?>
</td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('customer_passive_finished') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
</tr>
<tr id="termination-<?=$term->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?> hidden">
@@ -242,7 +257,7 @@
Nicht fertiggestellt.
</div>
</td>
<td colspan="8">
<td colspan="10">
<table class="table workflow-table table-bordered table-sm table-bg-<?=($bcount % 2 == 0) ? "odd" : "even"?>">
<tr>
<th>AP-Typ</th>
@@ -377,6 +392,8 @@
<th>Kundenkabel</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>FTU</th>
<th>FTU verlegt</th>
<th>Fertig</th>
</tr>
<?php endif; ?>

View File

@@ -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;
}*/
}

View File

@@ -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;
}

View File

@@ -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";
}