Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/rollup de fix #408

Merged
merged 4 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions api/sorties.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* detaillant l'erreur.
*/
function insert_pesee_sortie(PDO $bdd, int $id_sortie, array $sortie, array $items, string $id_type_field) {
$req = $bdd->prepare("INSERT INTO pesees_sorties (
$sql = "INSERT INTO pesees_sorties (
timestamp,
last_hero_timestamp,
masse,
Expand All @@ -60,7 +60,8 @@ function insert_pesee_sortie(PDO $bdd, int $id_sortie, array $sortie, array $ite
:$id_type_field,
:id_sortie,
:id_createur,
:id_createur1)");
:id_createur1)";
$req = $bdd->prepare($sql);

$req->bindValue(':timestamp', $sortie['timestamp']->format('Y-m-d H:i:s'), PDO::PARAM_STR);
$req->bindValue(':timestamp1', $sortie['timestamp']->format('Y-m-d H:i:s'), PDO::PARAM_STR);
Expand Down Expand Up @@ -182,14 +183,14 @@ classe,
$bdd->beginTransaction();
$id_sortie = (int) insert_sortie($bdd, $sortie);
$requete_OK = false;
if (count($json['items'] ?? 0) > 0) {
if (count($json['items'] ?? []) > 0) {
if ($sortie['classe'] === 'sorties' || $sortie['classe'] === 'sortiesc') {
insert_pesee_sortie($bdd, $id_sortie, $sortie, $json['items'], 'id_type_dechet');
$requete_OK = true;
}
}

if (count($json['evacs'] ?? 0) > 0) {
if (count($json['evacs'] ?? []) > 0) {
if ($sortie['classe'] === 'sortiesd'
|| $sortie['classe'] === 'sortiesc'
|| $sortie['classe'] === 'sortiesr'
Expand Down
2 changes: 1 addition & 1 deletion ifaces/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
const current_version_published = new Date('2020-10-01T12:00:00Z');
const greeting = `Bienvenue à bord d'Oressource ${current_version_number} ${user_name}!`;
// Changement du mesage de bienvenue
document.querySelector('#bienvenue h1').innerHTML = greeting;
document.querySelector('#bienvenue > h1:nth-child(1)').innerHTML = greeting;

fetch(`https://api.github.com/repos/mart1ver/oressource/releases`, {
method: "GET"
Expand Down
12 changes: 12 additions & 0 deletions mysql/2020-10-18_alter_pesees_sorties_FKs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Author: darnuria
* Created: Dec 18, 2020
*
* Bon c'était pas top top cette contrainte, façon le schema il est pas terrible.
* Il en faut au moins un parmis les trois vu le schema c'est trop complexe,
* pour faire ça vite.
*/

ALTER TABLE oressource.pesees_sorties DROP FOREIGN KEY FK_PeseesSorties_TypeDechets;
ALTER TABLE oressource.pesees_sorties DROP FOREIGN KEY FK_PeseesSorties_TypeDechetEvac;
ALTER TABLE oressource.pesees_sorties DROP FOREIGN KEY FK_PeseesSorties_TypePoubelles;