-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Migrate feedback session timeZone field to ZoneId #8638 #8639
Migrate feedback session timeZone field to ZoneId #8638 #8639
Conversation
3ca7cf9
to
411ddae
Compare
411ddae
to
dff2968
Compare
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.
Most of my comments are about this one thing: I think we should use something like ZoneId.of("+08:00")
in instead of TimeHelper.convertToZoneId
, as the later should be removed eventually once we finished migrating our UI and Database to ZoneId
eventually.
@@ -170,7 +168,7 @@ private void setTimeZoneFromOffsetIfRequired() { | |||
} else { | |||
offset = Double.valueOf(timeZone); | |||
} | |||
timeZone = convertOffsetToZoneId(offset); | |||
timeZone = TimeHelper.convertToZoneId(offset).getId(); |
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.
Are isTimeStoredInUtc
and timeZoneDouble
ready to be removed?
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.
Not yet; still pending a migration script (#8448) but it's not that high priority.
email = new EmailGenerator().generateFeedbackSubmissionConfirmationEmailForStudent(session, student1, time); | ||
subject = String.format(EmailType.FEEDBACK_SUBMISSION_CONFIRMATION.getSubject(), course.getName(), | ||
session.getFeedbackSessionName()); | ||
verifyEmail(email, student1.email, subject, "/sessionSubmissionConfirmationEmailPositiveTimeZone.html"); | ||
|
||
setTimeZoneButMaintainLocalDate(session, -9.5); | ||
setTimeZoneButMaintainLocalDate(session, TimeHelper.convertToZoneId(-9.5)); |
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 you should generate a ZoneId
directly, i.e. something like "-09:30"
. convertToZoneId
is just a temporary method, eventually we want to remove all instances of double
timezones
@@ -50,7 +51,7 @@ protected void prepareTestData() { | |||
.withInstructions(new Text("Please fill in the new feedback session.")) | |||
.withSentOpenEmail(false) | |||
.withSentPublishedEmail(false) | |||
.withTimeZone(8.0) | |||
.withTimeZone(TimeHelper.convertToZoneId(8)) |
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.
Just use something like ZoneId.of("+08:00")
? convertToZoneId
should be removed eventually.
@@ -295,7 +296,7 @@ private void testAddAction() throws Exception { | |||
|
|||
newSession.setFeedbackSessionName("Allow Early Viewing Session #"); | |||
newSession.setCourseId("CFeedbackUiT.CS1101"); | |||
newSession.setTimeZone(-4.5); | |||
newSession.setTimeZone(TimeHelper.convertToZoneId(-4.5)); |
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.
Just use something like ZoneId.of("-04:30")
? convertToZoneId
should be removed eventually.
@@ -342,7 +343,7 @@ private void testAddAction() throws Exception { | |||
newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER); | |||
newSession.setGracePeriod(25); | |||
newSession.setInstructions(instructions); | |||
newSession.setTimeZone(-2); | |||
newSession.setTimeZone(TimeHelper.convertToZoneId(-2)); |
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.
Just use something like ZoneId.of("-02:00")
? convertToZoneId
should be removed eventually.
@@ -946,7 +947,7 @@ private void testValidationReload() throws Exception { | |||
TimeHelper.parseLocalDateTime("01/04/2035", "10", "00"), | |||
TimeHelper.parseLocalDateTime("30/04/2035", "22", "00"), | |||
null, null, | |||
newSession.getInstructions(), newSession.getGracePeriod(), -2.0); | |||
newSession.getInstructions(), newSession.getGracePeriod(), TimeHelper.convertToZoneId(-2)); |
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.
Just use something like ZoneId.of("-02:00")
? convertToZoneId
should be removed eventually.
@@ -42,7 +41,8 @@ protected void prepareTestData() { | |||
FeedbackSessionAttributes gracedFeedbackSession = | |||
BackDoor.getFeedbackSession("SHomeUiT.CS2104", "Graced Feedback Session"); | |||
// TODO: change to actual now once HTML time zone detection is fixed |
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.
Have you document it somewhere, e.g. issues in case we forget this later?
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.
Just did - #8640.
@@ -72,7 +72,8 @@ public void testBuilderCopy() { | |||
.withEndTime(TimeHelperExtension.getInstantHoursOffsetFromNow(5)) | |||
.withSessionVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(1)) | |||
.withResultsVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(6)) | |||
.withTimeZone(8).withGracePeriod(0).withFeedbackSessionType(FeedbackSessionType.PRIVATE) | |||
.withTimeZone(TimeHelper.convertToZoneId(8)).withGracePeriod(0) |
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.
Just use something like ZoneId.of("+08:00")
? convertToZoneId
should be removed eventually.
@@ -680,7 +681,7 @@ private void testEnrollStudents() throws Exception { | |||
.withEndTime(TimeHelperExtension.getInstantHoursOffsetFromNow(5)) | |||
.withSessionVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(1)) | |||
.withResultsVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(6)) | |||
.withTimeZone(8) | |||
.withTimeZone(TimeHelper.convertToZoneId(8)) |
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.
Just use something like ZoneId.of("+08:00")
? convertToZoneId
should be removed eventually.
addFeedbackSessionWithTimeZone( | ||
feedbackSessionName, courseId, startTime, endTime, visibleTime, publishTime, instructions, gracePeriod, 8.0); | ||
addFeedbackSessionWithTimeZone(feedbackSessionName, courseId, startTime, endTime, visibleTime, publishTime, | ||
instructions, gracePeriod, TimeHelper.convertToZoneId(8)); |
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.
Just use something like ZoneId.of("+08:00")
? convertToZoneId
should be removed eventually.
Lol my comments point to error pages because of rebase. |
@tran-tien-dat I did think of that, but decided that we'll want to relook all of the test time zone data when we eventually support geographical region |
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.
👍 Just a query, otherwise all good from me.
@@ -52,6 +53,8 @@ | |||
respondingInstructorList = new HashSet<>(); | |||
respondingStudentList = new HashSet<>(); | |||
|
|||
timeZone = ZoneId.of("UTC"); |
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.
Should this be extracted to Const
as something like DEFAULT_TIME_ZONE
? A similar fall back is used in CoursesDb
.
Before the actual user interface is updated, tests will continue to use fixed offset time zones
dff2968
to
5f6b959
Compare
I don't think that's necessary. I took a look and most of these fixed time zones come from the page ui tests. When we migrate the UI front-end to use geographical timezones, these tests will necessarily need to be updated to pick the geographical timezones. Hence, the current hardcoded double timezones are just temporary until we finish migration as well. Well that also means the changes I'm suggesting will also be modified eventually, so just keep it like what you did is fine. |
Hmm, but for the 3 occurences of hardcoded timezones in the logic tests Furthermore, UTC time zones are currently hardcoded without the EDIT: time zone does play a role in |
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.
LGTM
@whipermr5 Travis is failing due to unused import 😛 |
115079d
to
089e3fa
Compare
Fixes #8638
Based on #8637. Commits start from 9b921d0.Script used to migrate JSON data: