refactoring compareThematiquePriority and in cas of equality sort by thematique alphabetical order

This commit is contained in:
Antoine M 2024-04-22 12:25:05 +02:00
parent 73014daa08
commit c0e204310e

View File

@ -128,12 +128,11 @@ function compareThematiquePriority($postA, $postB)
$priorityA = $postA->thematique_priority ?? 0; $priorityA = $postA->thematique_priority ?? 0;
$priorityB = $postB->thematique_priority ?? 0; $priorityB = $postB->thematique_priority ?? 0;
$thematiqueA = getPostMainThematique($postA);
$thematiqueB = getPostMainThematique($postB);
if ($priorityA == $priorityB) { if ($priorityA == $priorityB) {
if ($postA->post_date > $postB->post_date) { return strcmp($thematiqueA->name, $thematiqueB->name);
return -1;
} else {
return 1;
}
} }
if ($priorityA < $priorityB) { if ($priorityA < $priorityB) {
return 1; return 1;