From: Raphaƫl Gertz <git@rapsys.eu>
Date: Tue, 12 Dec 2023 17:41:51 +0000 (+0100)
Subject: Makes created, updated and modified the greatest of each
X-Git-Tag: 0.2~5
X-Git-Url: https://git.rapsys.eu/blogbundle/commitdiff_plain/7711361c419c68c35f8e59b93cbbcc9c15a33ed1

Makes created, updated and modified the greatest of each
---

diff --git a/Repository/ArticleRepository.php b/Repository/ArticleRepository.php
index 0d5a069..a19d63c 100644
--- a/Repository/ArticleRepository.php
+++ b/Repository/ArticleRepository.php
@@ -166,9 +166,9 @@ SQL;
 		$req = <<<SQL
 SELECT
 	b.id,
-	b.created,
-	b.updated,
-	b.modified,
+	GREATEST(b.created, kat.created) AS created,
+	GREATEST(b.updated, kat.updated) AS updated,
+	GREATEST(b.created, b.updated, kat.created, kat.updated) AS modified,
 	b.body,
 	b.description,
 	b.slug,
@@ -184,7 +184,6 @@ FROM (
 		a.id,
 		GREATEST(a.created, at.created, k.created, kt.created) AS created,
 		GREATEST(a.updated, at.updated, k.updated, kt.updated) AS updated,
-		GREATEST(a.created, at.created, k.created, kt.created, a.updated, at.updated, k.updated, kt.updated) AS modified,
 		at.body,
 		at.description,
 		at.slug,