Version 1.4.0 - Correction de bugs

This commit is contained in:
2025-12-06 22:20:22 +01:00
parent 4eae584706
commit 38dfcad27e
9 changed files with 185 additions and 61 deletions

View File

@@ -28,7 +28,14 @@ function getPersonalHistory(userId) {
*/
function addToPersonalHistory(userId, entry) {
hlog.log(`Ajout d'une entrée à l'historique personnel de l'utilisateur : ${userId}`);
// Check if there is already the same entry (by ID) and remove it to avoid duplicates
const history = getPersonalHistory(userId);
const existingIndex = history.findIndex(e => e.id === entry.id);
if (existingIndex !== -1) {
history.splice(existingIndex, 1);
}
// Limit to 25 entries
if (history.length >= 25) {
history.shift();