From f7e5426ebe1692d6c564fc89b18b60f63cb75ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gombault?= Date: Thu, 19 Sep 2024 11:44:45 +0200 Subject: [PATCH] fix duplicate birthday entries --- community/birthdays-widget.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/community/birthdays-widget.lua b/community/birthdays-widget.lua index 7dc90ea..2f5ed08 100644 --- a/community/birthdays-widget.lua +++ b/community/birthdays-widget.lua @@ -44,10 +44,19 @@ function redraw() events = {} local lines = {} for i,v in ipairs(contacts) do - table.insert(events, v) - table.insert(lines, fmt_line(v)) - if i == prefs.count then - break + local fmt_out = fmt_line(v) + local insert = 0 + if #lines == 0 then + insert = 1 + elseif not (fmt_out == lines[#lines]) then + insert = 1 + end + if insert == 1 then + table.insert(events, v) + table.insert(lines, fmt_out) + if #lines == prefs.count then + break + end end end ui:show_lines(lines)