Skip to content

Commit

Permalink
avniproject/avni-server#825 | Use "WithinNoOfDays" to determine how o…
Browse files Browse the repository at this point in the history
…ften to Nudge an Inactive user
  • Loading branch information
himeshr committed Feb 10, 2025
1 parent 9746a86 commit ce9d4cf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ private void processUser(NudgeUserRequestDTO nudgeUserRequestDTO) {
try {
ErrorRecord errorRecord = rwbUserNudgeErrorService.getErrorRecord(nudgeUserRequestDTO.getUserId());
if(errorRecord != null && errorRecord.getLastErrorRecordLog().getErrorType().getName().equals(RwbSendMsgErrorType.Success.name()) &&
DateTimeUtil.differenceWithNowLessThanInterval(errorRecord.getLastErrorRecordLog().getLoggedAt(), 7, Calendar.DAY_OF_MONTH)) {
logger.debug(String.format("User has already been nudged successfully in the last 1 week %s", nudgeUserRequestDTO.getUserId()));
DateTimeUtil.differenceWithNowLessThanInterval(errorRecord.getLastErrorRecordLog().getLoggedAt(),
Integer.parseInt(nudgeUserRequestDTO.getWithinNoOfDays()), Calendar.DAY_OF_MONTH)) {
logger.debug(String.format("User with id '%s' has already been nudged successfully in the last %s day(s).",
nudgeUserRequestDTO.getUserId(), nudgeUserRequestDTO.getWithinNoOfDays()));
return;
}
SendMessageResponse sendMessageResponse = rwbUserNudgeService.nudgeUser(nudgeUserRequestDTO);
Expand Down

0 comments on commit ce9d4cf

Please sign in to comment.