Skip to content

Commit

Permalink
Merge pull request #32 from monarc-project/bugfix/261
Browse files Browse the repository at this point in the history
Bugfix/261 Changed the recommendation sorting way.
  • Loading branch information
ruslanbaidan authored Apr 14, 2020
2 parents 26ed932 + f0733c9 commit 329104b
Show file tree
Hide file tree
Showing 17 changed files with 424 additions and 230 deletions.
2 changes: 1 addition & 1 deletion src/Controller/AuthenticationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function create($data)
]);
}

$this->getResponse()->setStatusCode(405);
$this->getResponse()->setStatusCode(401);

return new JsonModel([]);
}
Expand Down
10 changes: 6 additions & 4 deletions src/Model/Entity/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ public function exchangeArray(array $options, $partial = false)
if (!$this->squeezeAutoPositionning && isset($this->parameters['implicitPosition']['field'])) {
$parent_before = $this->get($this->parameters['implicitPosition']['field']);
if (is_object($parent_before)) {
$parent_before = !is_null($parent_before->get('uuid'))?$parent_before->get('uuid')->toString():$parent_before->get('id');
$parent_before = $parent_before->get('uuid') !== null
? (string)$parent_before->get('uuid')
: $parent_before->get('id');
}
$parent_after = array_key_exists($this->parameters['implicitPosition']['field'], $options) ? $options[$this->parameters['implicitPosition']['field']] : null;

Expand Down Expand Up @@ -305,11 +307,11 @@ private function calculatePosition($mode = self::IMP_POS_END, $previous = null,
$prec_parent_id = null;

if ($isParentable) {
$identifiers = is_null($prec->get($this->parameters['implicitPosition']['field'])) ? [] : $this->getDbAdapter()->getClassMetadata(ClassUtils::getRealClass(get_class($prec->get($this->parameters['implicitPosition']['field']))))->getIdentifierFieldNames();
$identifiers = $prec->get($this->parameters['implicitPosition']['field']) === null ? [] : $this->getDbAdapter()->getClassMetadata(ClassUtils::getRealClass(get_class($prec->get($this->parameters['implicitPosition']['field']))))->getIdentifierFieldNames();
if (in_array('uuid', $identifiers)) {
$prec_parent_id = is_null($prec->get($this->parameters['implicitPosition']['field'])) ? null : $prec->get($this->parameters['implicitPosition']['field'])->getUuid()->toString();
$prec_parent_id = $prec->get($this->parameters['implicitPosition']['field']) === null ? null : (string)$prec->get($this->parameters['implicitPosition']['field'])->getUuid();
} else {
$prec_parent_id = is_null($prec->get($this->parameters['implicitPosition']['field'])) ? null : $prec->get($this->parameters['implicitPosition']['field'])->get('id');
$prec_parent_id = $prec->get($this->parameters['implicitPosition']['field']) === null ? null : $prec->get($this->parameters['implicitPosition']['field'])->get('id');
}
}
$parent_after_id = (is_array($parent_after)&&array_key_exists('uuid', $parent_after))?$parent_after['uuid']:$parent_after;
Expand Down
6 changes: 3 additions & 3 deletions src/Model/Entity/AmvSuperClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ public function setUuid($id)
}

/**
* @return Anr
* @return AnrSuperClass
*/
public function getAnr()
{
return $this->anr;
}

/**
* @param Anr $anr
* @param AnrSuperClass $anr
*/
public function setAnr($anr)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getVulnerability()
}

/**
* @param Vulnerability $vulnerability
* @param VulnerabilitySuperClass $vulnerability
*/
public function setVulnerability($vulnerability)
{
Expand Down
36 changes: 23 additions & 13 deletions src/Model/Entity/AnrSuperClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,77 +135,77 @@ class AnrSuperClass extends AbstractEntity
*
* @ORM\Column(name="init_anr_context", type="smallint", options={"unsigned":true, "default":0})
*/
protected $initAnrContext = '0';
protected $initAnrContext = 0;

/**
* @var int
*
* @ORM\Column(name="init_eval_context", type="smallint", options={"unsigned":true, "default":0})
*/
protected $initEvalContext = '0';
protected $initEvalContext = 0;

/**
* @var int
*
* @ORM\Column(name="init_risk_context", type="smallint", options={"unsigned":true, "default":0})
*/
protected $initRiskContext = '0';
protected $initRiskContext = 0;

/**
* @var int
*
* @ORM\Column(name="init_def_context", type="smallint", options={"unsigned":true, "default":0})
*/
protected $initDefContext = '0';
protected $initDefContext = 0;

/**
* @var int
*
* @ORM\Column(name="init_livrable_done", type="smallint", options={"unsigned":true, "default":0})
*/
protected $initLivrableDone = '0';
protected $initLivrableDone = 0;

/**
* @var int
*
* @ORM\Column(name="model_summary", type="smallint", options={"unsigned":true, "default":0})
*/
protected $modelSummary = '0';
protected $modelSummary = 0;

/**
* @var int
*
* @ORM\Column(name="model_livrable_done", type="smallint", options={"unsigned":true, "default":0})
*/
protected $modelLivrableDone = '0';
protected $modelLivrableDone = 0;

/**
* @var int
*
* @ORM\Column(name="eval_risks", type="smallint", options={"unsigned":true, "default":0})
*/
protected $evalRisks = '0';
protected $evalRisks = 0;

/**
* @var int
*
* @ORM\Column(name="eval_plan_risks", type="smallint", options={"unsigned":true, "default":0})
*/
protected $evalPlanRisks = '0';
protected $evalPlanRisks = 0;

/**
* @var int
*
* @ORM\Column(name="eval_livrable_done", type="smallint", options={"unsigned":true, "default":0})
*/
protected $evalLivrableDone = '0';
protected $evalLivrableDone = 0;

/**
* @var int
*
* @ORM\Column(name="manage_risks", type="smallint", options={"unsigned":true, "default":0})
*/
protected $manageRisks = '0';
protected $manageRisks = 0;


/**
Expand Down Expand Up @@ -241,14 +241,14 @@ class AnrSuperClass extends AbstractEntity
*
* @ORM\Column(name="cache_model_show_rolf_brut", type="smallint", options={"unsigned":true, "default":0})
*/
protected $cacheModelShowRolfBrut = '0';
protected $cacheModelShowRolfBrut = 0;

/**
* @var int
*
* @ORM\Column(name="show_rolf_brut", type="smallint", options={"unsigned":true, "default":0})
*/
protected $showRolfBrut = '0';
protected $showRolfBrut = 0;

public function getId(): int
{
Expand Down Expand Up @@ -281,4 +281,14 @@ public function setObjects($objects): self

return $this;
}

public function getSeuilRolf1(): int
{
return $this->seuilRolf1;
}

public function getSeuilRolf2(): int
{
return $this->seuilRolf2;
}
}
Loading

0 comments on commit 329104b

Please sign in to comment.