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
[#9363] Replace questionMetaData with questionDetails in FeedbackQuestionAttributes #9410
[#9363] Replace questionMetaData with questionDetails in FeedbackQuestionAttributes #9410
Conversation
2fbdf46
to
e4c9c2a
Compare
836e241
to
86f69de
Compare
Ready for review |
src/main/java/teammates/common/datatransfer/questions/FeedbackTextQuestionDetails.java
Outdated
Show resolved
Hide resolved
src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java
Show resolved
Hide resolved
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
src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java
Outdated
Show resolved
Hide resolved
src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java
Outdated
Show resolved
Hide resolved
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Outdated
Show resolved
Hide resolved
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Outdated
Show resolved
Hide resolved
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Show resolved
Hide resolved
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Outdated
Show resolved
Hide resolved
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Outdated
Show resolved
Hide resolved
# Conflicts: # src/main/java/teammates/storage/api/FeedbackQuestionsDb.java # src/test/java/teammates/test/cases/logic/FeedbackQuestionsLogicTest.java
.withFeedbackSessionName("testFeedbackSession") | ||
.withGiverType(FeedbackParticipantType.INSTRUCTORS) | ||
.withRecipientType(FeedbackParticipantType.SELF) | ||
.withNumOfEntitiesToGiveFeedbackTo(1) |
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 use Const.MAX_POSSIBLE_RECIPIENTS
here.
@@ -417,7 +416,7 @@ public void testUpdateQuestionCascade() throws Exception { | |||
FeedbackQuestionAttributes questionToUpdate = getQuestionFromDatastore("qn2InSession1InCourse2"); | |||
|
|||
FeedbackQuestionDetails fqd = new FeedbackTextQuestionDetails("new question text"); | |||
questionToUpdate.questionMetaData = JsonUtils.toJson(fqd); | |||
questionToUpdate.questionDetails = fqd; |
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.
Use setQuestionDetail() here? Same as below.
((FeedbackTextQuestionDetails) ftqd1).setRecommendedLength(50); | ||
assertFalse(ftqd1.equals(ftqd2)); | ||
|
||
______TS("All attributes are same, should be same"); |
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.
- Test case for two references to the same question details?
- Test case for
null
input?
Basically, try to cover every statement for equal()
you introduced.
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!
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.
private static FeedbackQuestionDetails deserializeFeedbackTextQuestionDetails(String questionDetailsInJson) { | ||
try { | ||
// There are `FeedbackTextQuestion` with plain text, Json without `recommendedLength`, and complete Json | ||
// in data store. Gson cannot parse the plain text case, so we need to handle it separately. |
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.
@xpdavid this sounds like something that needs data migration.
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.
Yup. But it is not introduced in this PR. It a legacy pending data migration introduced long time ago :p
…dbackQuestionAttributes (TEAMMATES#9410) [TEAMMATES#9363] Replace questionMetaData with questionDetails in FeedbackQuestionAttributes (TEAMMATES#9410)
Fixes #9363
Outline of Solution
Replace the feedbackResponseMetadata to feedbackResponseDetails. Change the field in
.json
file as well. Customize the Json Deserialize Adaptor to deserializeFeedbackQuestionDetails
to its corresponding subclass.The challenge is
FeedbackTextQuestionDetails
. Due to the legacy data in data store before there were multiple question types, the json string ofFeedbackTextQuestionDetails
is the plain text of question text. However, as therecommendedLength
was added, the plain text is not applicable any more. Therefore, in.json
files and data store, there are bothFeedbackTextQuestionDetails
with and withoutrecommendedLength
information. We need to handle them separatelyThe script to change
.json
files can be found here