Skip to content

Commit 4259568

Browse files
christolisTheCodeMrcabagbedevloves
committed
fix: include anniversary logic for cake day
Co-authored-by: TheCodeMr <151576372+TheCodeMr@users.noreply.github.com> Co-authored-by: cab <161495905+cabagbe@users.noreply.github.com> Co-authored-by: Devansh Tiwari <65783463+devloves@users.noreply.github.com>
1 parent c1f7448 commit 4259568

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

application/src/main/java/org/togetherjava/tjbot/features/cakeday/CakeDayService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ protected boolean isUserCached(User user) {
294294
protected boolean hasMemberCakeDayToday(Member member) {
295295
OffsetDateTime now = OffsetDateTime.now();
296296
OffsetDateTime joinMonthDate = member.getTimeJoined();
297+
int anniversary = now.getYear() - joinMonthDate.getYear();
297298

298-
return now.getMonth() == joinMonthDate.getMonth()
299+
return anniversary > 0 && now.getMonth() == joinMonthDate.getMonth()
299300
&& now.getDayOfMonth() == joinMonthDate.getDayOfMonth();
300301
}
301302

0 commit comments

Comments
 (0)