-
Notifications
You must be signed in to change notification settings - Fork 2
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
Improve trip alert template (push + email) #196
Conversation
…files are first generated and need to be regenerated when template files are changed.
I stuck a Javadoc comment on the unit test, to describe the magical behind-the-scenes snapshot file creation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Code looks good to me.
Thanks for the Javadoc @JymDyerIBI ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One piece of code needs to be updated, and some formatting comments.
src/main/java/org/opentripplanner/middleware/models/TripMonitorNotification.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/middleware/tripmonitor/jobs/CheckMonitoredTrip.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opentripplanner/middleware/utils/TemplateUtilsTest.java
Outdated
Show resolved
Hide resolved
"notifications", new ArrayList<>(notifications).stream() | ||
// Make certain notifications, such as the initial reminder one, appear on top. | ||
.sorted(Comparator.comparingInt(TripMonitorNotification::sortOrder)) | ||
.map(notification -> notification.body) | ||
.map(notification -> Map.of( | ||
"type", notification.type.toString(), | ||
"body", notification.body | ||
)) | ||
.collect(Collectors.toList()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I think this should be simply:
"notifications", new ArrayList<>(notifications).stream() | |
// Make certain notifications, such as the initial reminder one, appear on top. | |
.sorted(Comparator.comparingInt(TripMonitorNotification::sortOrder)) | |
.map(notification -> notification.body) | |
.map(notification -> Map.of( | |
"type", notification.type.toString(), | |
"body", notification.body | |
)) | |
.collect(Collectors.toList()) | |
"notifications", new ArrayList<>(notifications) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the changes!
Checklist
Description
Push
Bullet point only present if >1 alert
Email
Also moves initial reminder ("Reminder for your upcoming trip...") outside of the list and to top of email