-
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
Post deviated trip notification #260
base: dev
Are you sure you want to change the base?
Conversation
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.
A few comments, but pretty solid so far.
/** | ||
* Get users whose last trip survey notification was at least a week ago. | ||
*/ | ||
public static List<OtpUser> getUsersWithNotificationsOverAWeekAgo() { |
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.
Is or should there be a option to opt-out of receiving surveys?
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.
No opt-out of post-travel surveys at the moment.
@@ -84,6 +85,16 @@ public static void main(String[] args) throws IOException, InterruptedException | |||
1, | |||
TimeUnit.MINUTES | |||
); | |||
|
|||
// Schedule recurring job for post-trip surveys, once every few hours | |||
// TODO: Determine whether this should go in some other process. |
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.
I think the trigger location is fine. Perhaps follow the approach of ConnectedDataManager.scheduleTripHistoryUploadJob();
and have the schduler in the class. It might also be benefical to have the ability to disable this via a config property.
Scheduler.scheduleJob( | ||
tripSurveySenderJob, | ||
0, | ||
12, |
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.
Do we want to send notifications potentially in the early hours of the morning? Do we care? Might get a better response in working hours.
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.
Morning local time sounds good. Do you know how to do that with this scheduler?
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.
Workout the diff between now and the next 9am in seconds and use that as the initial delay. Time unit used by the scheduler would have to be seconds.
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.
Change on when notifications are sent: within 20-30 minutes of trip completion.
@@ -76,6 +77,9 @@ public enum Notification { | |||
/** Whether to store the user's trip history (user must opt in). */ | |||
public boolean storeTripHistory; | |||
|
|||
/** When the last post-trip survey notification was sent. */ | |||
public Date lastTripSurveyNotificationSent; |
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.
This is only referenced in tests. I think it is updated via the field reference above, so is required at a DB level?
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.
Yes, this field is needed to keep track of when a post-travel notification was sent when subsequent trips are completed.
} | ||
|
||
@Test | ||
void canGetUsersWithNotificationsOverAWeekAgo() { |
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.
This test fails for me: expected: <2> but was: <3>
. Perhaps OS?
…hold to select trips.
Checklist
dev
before they can be merged tomaster
)Description
This PR sets up a job to send post-trip surveys for users who took trips the day before.
Blockers: