Skip to content

Commit

Permalink
[BF] - Available Patch Panel Ports not correct - #346
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrobin committed Oct 9, 2017
1 parent 0c2fb6c commit fd7809a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion database/Entities/PatchPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
use D2EM;
use Doctrine\Common\Collections\ArrayCollection;

use Entities\{
PatchPanelPort as PatchPanelPortEntity
};

/**
* Entities\PatchPanel
*/
Expand Down Expand Up @@ -540,8 +544,16 @@ public function getPortCount(): int {
public function getAvailableForUsePortCount(): int {
$cnt = 0;
foreach( $this->patchPanelPorts as $ppp ) {
/** @var PatchPanelPortEntity $ppp */
if( $ppp->isAvailableForUse() ) {
$cnt++;
if( $ppp->getDuplexMasterPort() ){
if( $ppp->getDuplexMasterPort()->getState() == $ppp->getState() ){
$cnt++;
}
}else{
$cnt++;
}

}
}
return $cnt;
Expand Down

0 comments on commit fd7809a

Please sign in to comment.