Skip to content

fix: Clean up notification effect [DHIS2-17243] #17936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Conversation

enricocolasante
Copy link
Contributor

@enricocolasante enricocolasante commented Jul 1, 2024

Notification effects can be simplified and shaped in a better way to be handled in tracker.

  • Update NotificationEffect to hold all and only the relevant information to correctly handle notifications. Removed the type and ruleUid.
  • Remove RuleActionScheduleMessageImplementer and RuleActionSendMessageImplementer and create NotificationSender that will send the notification if no date is provided or schedule the notification on the provided date.

@enricocolasante enricocolasante marked this pull request as ready for review July 1, 2024 14:44

programNotificationInstanceService.save(notificationInstance);

log.info(String.format(LOG_MESSAGE, template.getUid()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging should be done using parameterized messages https://www.slf4j.org/faq.html#logging_performance

Should that be an info log? To me this is debug. We log to much IMHO. This is why we have the logging group combing through logs 😅

Ask yourself who would want to see this and what should they do with it? Logs should be actionable by the operator of DHIS2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enricocolasante I think we should still address this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed it.
I think it didn't really make any sense to log a scheduled notification and not the sent one.
Scheduled notifications are saved somewhere in the system. If there is any need to debug it will be better to check the DB or the endpoint if we have one to understand what happened

@enricocolasante enricocolasante requested a review from teleivo July 2, 2024 08:47
@enricocolasante enricocolasante requested a review from teleivo July 2, 2024 09:20
@@ -92,7 +93,7 @@
return entityReport.stream().flatMap(e -> e.getErrorReports().stream()).toList();
}

public List<TrackerSideEffectDataBundle> getSideEffectDataBundles() {
return sideEffectDataBundles;
public List<TrackerNotificationDataBundle> getNotificationDataBundles() {

Check notice

Code scanning / CodeQL

Exposing internal representation Note

getNotificationDataBundles exposes the internal representation stored in field notificationDataBundles. The value may be modified
after this call to getNotificationDataBundles
.
getNotificationDataBundles exposes the internal representation stored in field notificationDataBundles. The value may be modified after this call to getNotificationDataBundles.
Copy link

sonarqubecloud bot commented Jul 2, 2024

@enricocolasante enricocolasante merged commit 3dd7167 into master Jul 2, 2024
15 checks passed
@enricocolasante enricocolasante deleted the DHIS2-17243 branch July 2, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants