0.00% covered (danger)
@@ -71,21 +71,21 @@
repos |
-
- 96.67% covered (success)
+
+ 96.88% covered (success)
|
- 96.67% |
- 203 / 210 |
+ 96.88% |
+ 217 / 224 |
-
- 80.00% covered (warning)
+
+ 80.77% covered (warning)
|
- 80.00% |
- 20 / 25 |
+ 80.77% |
+ 21 / 26 |
diff --git a/coverage/repos/MedecinRepo.php.html b/coverage/repos/MedecinRepo.php.html
index a976f66..dbde13b 100755
--- a/coverage/repos/MedecinRepo.php.html
+++ b/coverage/repos/MedecinRepo.php.html
@@ -61,13 +61,13 @@
6 / 7 |
CRAP |
-
- 97.06% covered (success)
+
+ 96.97% covered (success)
|
- 97.06% |
- 33 / 34 |
+ 96.97% |
+ 32 / 33 |
|
@@ -90,13 +90,13 @@
6 / 7 |
17 |
-
- 97.06% covered (success)
+
+ 96.97% covered (success)
|
- 97.06% |
- 33 / 34 |
+ 96.97% |
+ 32 / 33 |
@@ -159,11 +159,11 @@
100.00% |
- 4 / 4 |
+ 3 / 3 |
- search |
+ search |
100.00% covered (success)
@@ -184,7 +184,7 @@
|
- getPatients |
+ getPatients |
100.00% covered (success)
@@ -205,7 +205,7 @@
|
- getAll |
+ getAll |
100.00% covered (success)
@@ -226,7 +226,7 @@
|
- update |
+ update |
100.00% covered (success)
@@ -295,58 +295,56 @@
| |
| if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; |
| |
- | var_dump($idMedecin); |
- | |
- | $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); |
- | return $req->execute(['id' => $idMedecin]); |
- | } |
+ | $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); |
+ | return $req->execute(['id' => $idMedecin]); |
+ | } |
+ | |
+ | public static function search($nom, $prenom){ |
| |
- | public static function search($nom, $prenom){ |
+ | if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false; |
| |
- | if( !StaticRepo::checkParam($prenom,'String45') | !StaticRepo::checkParam($nom,'String45') ) return false; |
- | |
- | |
- | $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; |
- | $optNom = ( $nom != 'null' && StaticRepo::checkParam($nom, 'String45') ) ? '%'.$nom.'%' : '%'; |
- | |
- | $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Prenom, Nom |
- | FROM Medecin |
- | WHERE Nom LIKE '".$optNom."' |
- | AND Prenom LIKE '".$optPrenom."' |
- | ORDER BY Nom, Prenom ASC"); |
- | |
- | |
- | return StaticRepo::delNumeric( $req->fetchAll() ); |
- | } |
+ | |
+ | $optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%'; |
+ | $optNom = ( $nom != 'null' && StaticRepo::checkParam($nom, 'String45') ) ? '%'.$nom.'%' : '%'; |
+ | |
+ | $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Prenom, Nom |
+ | FROM Medecin |
+ | WHERE Nom LIKE '".$optNom."' |
+ | AND Prenom LIKE '".$optPrenom."' |
+ | ORDER BY Nom, Prenom ASC"); |
+ | |
+ | |
+ | return StaticRepo::delNumeric( $req->fetchAll() ); |
+ | } |
+ | |
+ | public static function getPatients($idMedecin){ |
| |
- | public static function getPatients($idMedecin){ |
+ | if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; |
| |
- | if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; |
- | |
- | $req = StaticRepo::getConnexion()->prepare('SELECT Patient.* FROM Patient,Medecin |
- | WHERE Medecin.Id = :id |
- | AND Medecin.Id = Patient.MedecinTraitant'); |
- | |
- | $req->execute(['id' => $idMedecin]); |
- | return StaticRepo::delNumeric($req->fetchAll()); |
- | } |
+ | $req = StaticRepo::getConnexion()->prepare('SELECT Patient.* FROM Patient,Medecin |
+ | WHERE Medecin.Id = :id |
+ | AND Medecin.Id = Patient.MedecinTraitant'); |
+ | |
+ | $req->execute(['id' => $idMedecin]); |
+ | return StaticRepo::delNumeric($req->fetchAll()); |
+ | } |
+ | |
+ | public static function getAll(){ |
| |
- | public static function getAll(){ |
+ | $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); |
| |
- | $req = StaticRepo::getConnexion()->query('SELECT * FROM Medecin ORDER BY nom, prenom ASC'); |
+ | return StaticRepo::delNumeric( $req->fetchAll() ); |
| |
- | return StaticRepo::delNumeric( $req->fetchAll() ); |
+ | } |
| |
- | } |
- | |
+ | |
+ | public static function update($id, $nom, $prenom){ |
| |
- | public static function update($id, $nom, $prenom){ |
- | |
- | $req = StaticRepo::getConnexion()->prepare("UPDATE Medecin SET Nom = :nom, Prenom = :prenom WHERE Id = :id"); |
- | return $req->execute([ ':nom' => strtoupper($nom), ':prenom' => $prenom, ':id' => $id ]); |
- | } |
- | |
- | } |
+ | $req = StaticRepo::getConnexion()->prepare("UPDATE Medecin SET Nom = :nom, Prenom = :prenom WHERE Id = :id"); |
+ | return $req->execute([ ':nom' => strtoupper($nom), ':prenom' => $prenom, ':id' => $id ]); |
+ | } |
+ | |
+ | } |
@@ -359,7 +357,7 @@
Dead Code
- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 18:13:26 UTC 2016.
+ Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 19:23:14 UTC 2016.
diff --git a/coverage/repos/PatientRepo.php.html b/coverage/repos/PatientRepo.php.html
index f1b9cd8..d8e70e1 100755
--- a/coverage/repos/PatientRepo.php.html
+++ b/coverage/repos/PatientRepo.php.html
@@ -465,7 +465,7 @@
Dead Code
- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 18:13:26 UTC 2016.
+ Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 19:23:14 UTC 2016.
diff --git a/coverage/repos/RDVRepo.php.html b/coverage/repos/RDVRepo.php.html
index 97e0c8a..9575432 100755
--- a/coverage/repos/RDVRepo.php.html
+++ b/coverage/repos/RDVRepo.php.html
@@ -51,23 +51,23 @@
|
0.00% |
0 / 1 |
-
-
- 88.89% covered (warning)
-
-
- |
- 88.89% |
- 8 / 9 |
- CRAP |
-
- 96.77% covered (success)
+
+ 90.00% covered (success)
|
- 96.77% |
- 60 / 62 |
+ 90.00% |
+ 9 / 10 |
+ CRAP |
+
+
+ 97.40% covered (success)
+
+
+ |
+ 97.40% |
+ 75 / 77 |
@@ -80,23 +80,23 @@
0.00% |
0 / 1 |
-
-
- 88.89% covered (warning)
-
-
- |
- 88.89% |
- 8 / 9 |
- 25 |
-
- 96.77% covered (success)
+
+ 90.00% covered (success)
|
- 96.77% |
- 60 / 62 |
+ 90.00% |
+ 9 / 10 |
+ 35 |
+
+
+ 97.40% covered (success)
+
+
+ |
+ 97.40% |
+ 75 / 77 |
@@ -193,7 +193,7 @@
100.00% |
1 / 1 |
- 6 |
+ 7 |
100.00% covered (success)
@@ -201,11 +201,11 @@
|
100.00% |
- 12 / 12 |
+ 13 / 13 |
- updateDateTime |
+ updateDateTime |
100.00% covered (success)
@@ -214,7 +214,7 @@
|
100.00% |
1 / 1 |
- 2 |
+ 3 |
100.00% covered (success)
@@ -222,11 +222,11 @@
|
100.00% |
- 6 / 6 |
+ 9 / 9 |
- getByPatientAndDate |
+ getByPatientAndDate |
100.00% covered (success)
@@ -247,7 +247,7 @@
|
- getAll |
+ getAll |
0.00% covered (danger)
@@ -268,7 +268,7 @@
|
- getByMonth |
+ getByMonth |
100.00% covered (success)
@@ -288,6 +288,27 @@
7 / 7 |
|
+
+ isPossible |
+
+
+ 100.00% covered (success)
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+ 8 |
+
+
+ 100.00% covered (success)
+
+
+ |
+ 100.00% |
+ 11 / 11 |
+
+
@@ -306,11 +327,11 @@
| |
| public static function getById($id){ |
| |
-
| if(!StaticRepo::checkParam($id,'Integer')){return false;} |
+
| if(!StaticRepo::checkParam($id,'Integer')){return false;} |
| |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE RDV.id = :id'); |
-
| $req->execute(['id' => $id]); |
-
| return StaticRepo::delNumeric( $req->fetch(), true ); |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE RDV.id = :id'); |
+
| $req->execute(['id' => $id]); |
+
| return StaticRepo::delNumeric( $req->fetch(), true ); |
| |
| } |
| |
@@ -328,12 +349,12 @@
| |
| public static function getByDate($date){ |
| |
-
| if(!StaticRepo::checkParam($date,'Date')){return false;} |
+
| if(!StaticRepo::checkParam($date,'Date')){return false;} |
| |
-
| $date = date('Y-m-d',strtotime($date)); |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) = :date ORDER BY DateRDV ASC'); |
-
| $req->execute(['date' => $date]); |
-
| return StaticRepo::delNumeric($req->fetchAll()); |
+
| $date = date('Y-m-d',strtotime($date)); |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * , ((HOUR(Duree)*60)+MINUTE(Duree)) AS Minute FROM RDV WHERE DATE(DateRDV) = :date ORDER BY DateRDV ASC'); |
+
| $req->execute(['date' => $date]); |
+
| return StaticRepo::delNumeric($req->fetchAll()); |
| } |
| |
| public static function delete($idRDV){ |
@@ -348,83 +369,115 @@
| |
| if(!StaticRepo::checkParam($date,'Date') && !StaticRepo::checkParam($duree,'Integer') && !StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($idMedecin,'Integer')){return false;} |
| |
-
| $date = date('Y-m-d H:i:s',strtotime($date)); |
-
| $duree = date('H:i:s',$duree*60); |
-
| $req = StaticRepo::getConnexion()->prepare('INSERT INTO RDV VALUES (DEFAULT,:date,:duree,:patient,:medecin)'); |
-
| $result = $req->execute(['date' => $date, |
-
| 'duree' => $duree, |
-
| 'patient' => $idPatient, |
-
| 'medecin' => $idMedecin]); |
-
| |
-
| |
-
| $id = StaticRepo::getConnexion()->lastInsertId(); |
-
| settype($id,'integer'); |
-
| if($result){return $id;} |
-
| else{return false;} |
-
| } |
-
| |
-
| public static function updateDateTime($idRDV, $dateRdv, $duree){ |
+
| if(!static::isPossible($date,$duree,$idMedecin)){return false;} |
+
| |
+
| $date = date('Y-m-d H:i:s',strtotime($date)); |
+
| $duree = date('H:i:s',$duree*60); |
+
| $req = StaticRepo::getConnexion()->prepare('INSERT INTO RDV VALUES (DEFAULT,:date,:duree,:patient,:medecin)'); |
+
| $result = $req->execute(['date' => $date, |
+
| 'duree' => $duree, |
+
| 'patient' => $idPatient, |
+
| 'medecin' => $idMedecin]); |
+
| |
+
| |
+
| $id = StaticRepo::getConnexion()->lastInsertId(); |
+
| settype($id,'integer'); |
+
| if($result){return $id;} |
+
| else{return false;} |
+
| } |
| |
-
| if(!StaticRepo::checkParam($idRDV, 'Numeric')) return false; |
+
| public static function updateDateTime($idRDV, $dateRdv, $duree){ |
| |
-
| $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id'); |
-
| return $req->execute([ |
-
| ':date_rdv' => $dateRdv, |
-
| ':duree' => $duree, |
-
| ':id' => $idRDV |
-
| ]); |
-
| } |
+
| if(!StaticRepo::checkParam($idRDV, 'Numeric')) return false; |
+
| |
+
| $rdv = static::getById($idRDV); |
+
| |
+
| $dateRdv = date('Y-m-d H:i:s',strtotime($dateRdv)); |
+
| |
+
| if(!static::isPossible($dateRdv,((date('H',strtotime($duree))*60)+date('i',strtotime($duree))),$rdv['Medecin_id'],$idRDV)){return false;} |
| |
-
| public static function getByPatientAndDate($idPatient,$date){ |
-
| |
-
| if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($date,'Date')){return false;} |
-
| |
-
| $date = date('Y-m-d',strtotime($date)); |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE Patient_Id=:patient AND DATE(DateRDV)=:date'); |
-
| $req->execute(['patient' => $idPatient, |
-
| 'date' => $date]); |
-
| return StaticRepo::delNumeric($req->fetchAll()); |
-
| } |
-
| |
-
| public static function getAll($date = 0){ |
-
| |
-
| if(!StaticRepo::checkParam($date,'Integer')){return false;} |
-
| |
-
| $dateTime = date('Y-m-d',time()); |
-
| switch($date){ |
-
| case -1: |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) <= :date ORDER BY DateRDV ASC'); |
-
| $req->execute(['date' => $dateTime]); |
-
| break; |
-
| case 0: |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV ORDER BY DateRDV ASC'); |
-
| $req->execute(); |
-
| break; |
-
| case 1: |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) >= :date ORDER BY DateRDV ASC'); |
+
| $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id'); |
+
| return $req->execute([ |
+
| ':date_rdv' => $dateRdv, |
+
| ':duree' => $duree, |
+
| ':id' => $idRDV |
+
| ]); |
+
| } |
+
| |
+
| public static function getByPatientAndDate($idPatient,$date){ |
+
| |
+
| if(!StaticRepo::checkParam($idPatient,'Integer') && !StaticRepo::checkParam($date,'Date')){return false;} |
+
| |
+
| $date = date('Y-m-d',strtotime($date)); |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE Patient_Id=:patient AND DATE(DateRDV)=:date'); |
+
| $req->execute(['patient' => $idPatient, |
+
| 'date' => $date]); |
+
| return StaticRepo::delNumeric($req->fetchAll()); |
+
| } |
+
| |
+
| public static function getAll($date = 0){ |
+
| |
+
| if(!StaticRepo::checkParam($date,'Integer')){return false;} |
+
| |
+
| $dateTime = date('Y-m-d',time()); |
+
| switch($date){ |
+
| case -1: |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) <= :date ORDER BY DateRDV ASC'); |
| $req->execute(['date' => $dateTime]); |
| break; |
-
| } |
-
| return StaticRepo::delNumeric($req->fetchAll()); |
-
| } |
-
| |
-
| public static function getByMonth($date){ |
-
| |
-
| $strDate = date( 'Y-m-d', $date ); |
-
| |
-
| |
-
| if( !StaticRepo::checkParam($strDate, 'Date') ) return []; |
-
| |
-
| $req = StaticRepo::getConnexion()->prepare('SELECT *, ((HOUR(Duree)*60)+MINUTE(Duree)) AS Minute FROM RDV WHERE MONTH(DateRDV) = :month AND YEAR(DateRDV) = :year ORDER BY DateRDV ASC'); |
-
| $req->execute([ |
-
| 'month' => date( 'm', $date ), |
-
| 'year' => date( 'Y', $date ) |
-
| ]); |
-
| |
-
| return StaticRepo::delNumeric( $req->fetchAll() ); |
-
| } |
-
| |
-
| } |
+
| case 0: |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV ORDER BY DateRDV ASC'); |
+
| $req->execute(); |
+
| break; |
+
| case 1: |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT * FROM RDV WHERE DATE(DateRDV) >= :date ORDER BY DateRDV ASC'); |
+
| $req->execute(['date' => $dateTime]); |
+
| break; |
+
| } |
+
| return StaticRepo::delNumeric($req->fetchAll()); |
+
| } |
+
| |
+
| public static function getByMonth($date){ |
+
| |
+
| $strDate = date( 'Y-m-d', $date ); |
+
| |
+
| |
+
| if( !StaticRepo::checkParam($strDate, 'Date') ) return []; |
+
| |
+
| $req = StaticRepo::getConnexion()->prepare('SELECT *, ((HOUR(Duree)*60)+MINUTE(Duree)) AS Minute FROM RDV WHERE MONTH(DateRDV) = :month AND YEAR(DateRDV) = :year ORDER BY DateRDV ASC'); |
+
| $req->execute([ |
+
| 'month' => date( 'm', $date ), |
+
| 'year' => date( 'Y', $date ) |
+
| ]); |
+
| |
+
| return StaticRepo::delNumeric( $req->fetchAll() ); |
+
| } |
+
| |
+
| public static function isPossible($date,$duree,$medecin,$ignore = -1){ |
+
| $dateRequest = date('Y-m-d',strtotime($date)); |
+
| |
+
| |
+
| $rdvs = static::getByDate($dateRequest); |
+
| |
+
| foreach($rdvs as $rdv){ |
+
| if($rdv['Medecin_id'] == $medecin and $rdv['Id'] != $ignore){ |
+
| $minDate = strtotime($rdv['DateRDV']); |
+
| $maxDate = $minDate + $rdv['Minute']*60; |
+
| |
+
| $actualMinDate = strtotime($date); |
+
| $actualMaxDate = $actualMinDate+($duree*60); |
+
| |
+
| if( ($minDate <= $actualMinDate) && ($actualMinDate <= $maxDate) || ($minDate <= $actualMaxDate) && ($actualMaxDate <= $maxDate)){ |
+
| return false; |
+
| } |
+
| } |
+
| } |
+
| |
+
| return true; |
+
| |
+
| } |
+
| |
+
| } |
@@ -437,7 +490,7 @@
Dead Code
- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 18:13:26 UTC 2016.
+ Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 19:23:14 UTC 2016.
diff --git a/coverage/repos/StatsRepo.php.html b/coverage/repos/StatsRepo.php.html
index fd9296a..03735a0 100755
--- a/coverage/repos/StatsRepo.php.html
+++ b/coverage/repos/StatsRepo.php.html
@@ -220,7 +220,7 @@
Dead Code
- Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 18:13:26 UTC 2016.
+ Generated by PHP_CodeCoverage 3.0.2 using PHP 7.0.1 and PHPUnit 5.1.3 at Sun Jan 3 19:23:14 UTC 2016.
diff --git a/coverage/repos/dashboard.html b/coverage/repos/dashboard.html
index 4c448ba..6a1baf3 100755
--- a/coverage/repos/dashboard.html
+++ b/coverage/repos/dashboard.html
@@ -112,7 +112,7 @@