Skip to content

Please See PR 173#172

Merged
darknoon29 merged 1 commit intodevelopfrom
feature/advanced_search
Apr 27, 2020
Merged

Please See PR 173#172
darknoon29 merged 1 commit intodevelopfrom
feature/advanced_search

Conversation

@darknoon29
Copy link
Copy Markdown
Member

Remonté par Binu.

Il y a pas mal de travail et donc pas mal de relecture aussi :-)

@darknoon29 darknoon29 changed the base branch from master to develop April 17, 2020 15:30
Copy link
Copy Markdown
Contributor

@pitch314 pitch314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les conditions des tests sont à revoir pour éviter des erreurs d'interprétations PHP.
Sinon d'un point de vue algorithmique cela est bon.
PS : avant de l'intégrer un formatage formatage du code (espace, indentation, etc.)

//Binu : ajout d'une fonction pour convertir les coordonn�es de la table universe en coordonn�es de la table spy
public function getArrayCoordinates()
{
if ($this->galaxy_down != null && $this->galaxy_up != null){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparaison à revoir, réfléchir à quoi on veux tester.
Changer les != NULL en soit !== NULL, soit en isset() (ou empty()).

}else{
$galaxy = array(1,$this->server_config['num_of_galaxies']);
}
if ($this->system_down != null && $this->system_up != null){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem
Comparaison à revoir, réfléchir à quoi on veux tester.
Changer les != NULL en soit !== NULL, soit en isset() (ou empty()).

}else{
$system = array(1,$this->server_config['num_of_systems']);
}
if ($this->row_down != null && $this->row_up != null){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem
Comparaison à revoir, réfléchir à quoi on veux tester.
Changer les != NULL en soit !== NULL, soit en isset() (ou empty()).

Comment thread includes/galaxy.php
case "colonization":
$criteria->setPlanetName("");
// $criteria->setPlanetName("");
//Binu : utilisation d'une chaine non vide, sinon celle-ci est considérée comme null et le critère n'est pas utilisé
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce n'est pas ici qu'il faut mettre une rustine mais il faut corriger là où la variable est utilisée

Comment thread model/Universe_Model.php
@@ -398,27 +398,32 @@ public function find(SearchCriteria_Helper $criteria, array $order_by = array(),
}

if ($criteria->getPlanetName() != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est ici que le problème ce trouve car ce test est non déterministe.
Comparaison à revoir, réfléchir à quoi on veux tester.
Changer les != NULL en soit !== NULL, soit en isset() (ou empty()) ou === ''

Comment thread model/Universe_Model.php
}
$where .= " `moon` = 1";
//Binu : ajout des cotes
$where .= " `moon` = '1'";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien

Comment thread model/Universe_Model.php
if (($criteria->getGalaxyDown() != null && $criteria->getGalaxyUp() != null) || ($criteria->getSystemDown() != null && $criteria->getSystemUp() != null) || ($criteria->getRowDown() != null && $criteria->getRowUp() != null)){
$coordinates = $criteria->getArrayCoordinates();
$spy_where .= " AND ";
if (count($coordinates) > 1){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimisation : count() sur la même variable, sans changement, est utilisé plusieurs fois et ceux dans des boucles.
=>créer un variable pour réduire le temps d'exécution ($nb_coor =count($coordinates par exemple)

Comment thread model/Universe_Model.php

$spy_query = "SELECT `coordinates`, `active` FROM " . TABLE_PARSEDSPY . " WHERE `active` = '1'";
$spy_where = "";
if (($criteria->getGalaxyDown() != null && $criteria->getGalaxyUp() != null) || ($criteria->getSystemDown() != null && $criteria->getSystemUp() != null) || ($criteria->getRowDown() != null && $criteria->getRowUp() != null)){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem
Comparaison à revoir, réfléchir à quoi on veux tester.
Changer les != NULL en soit !== NULL, soit en isset() (ou empty()).

@darknoon29 darknoon29 changed the title Feature/advanced search Please See PR 173 Apr 21, 2020
@darknoon29 darknoon29 merged commit 8144a75 into develop Apr 27, 2020
@darknoon29 darknoon29 deleted the feature/advanced_search branch April 27, 2020 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants