diff --git a/models/Movie.php b/models/Movie.php index 3979bf7..6dac8e4 100644 --- a/models/Movie.php +++ b/models/Movie.php @@ -63,13 +63,11 @@ class Movie { } // 3. Commune - $stmt = $this->db->prepare(" - SELECT MAX(id) as id, tmdb_id, title, poster_path, media_type, is_common, MAX(added_at) as added_at - FROM movies - WHERE is_common = 1 AND (user_id = ? OR user_id = ?) - GROUP BY tmdb_id, title, poster_path, media_type, is_common - "); - $stmt->execute([$myId, $partnerId]); + // On renvoie MA propre ligne (pas une fusion avec celle du/de la partenaire) : + // chacun a sa propre ligne is_common=1 pour le même film, et remove/mark-watched + // ont besoin de MON id pour agir sur MA ligne, pas une autre. + $stmt = $this->db->prepare("SELECT * FROM movies WHERE user_id = ? AND is_common = 1 ORDER BY added_at DESC"); + $stmt->execute([$myId]); $common = $stmt->fetchAll(PDO::FETCH_ASSOC); return ["perso" => $perso, "partner" => $partner, "common" => $common];