Skip to content
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

Merged
merged 21 commits into from Feb 22, 2019

Conversation

Adoby7
Copy link
Contributor

@Adoby7 Adoby7 commented Feb 9, 2019

Fixes #9363

Outline of Solution

Replace the feedbackResponseMetadata to feedbackResponseDetails. Change the field in .json file as well. Customize the Json Deserialize Adaptor to deserialize FeedbackQuestionDetails 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 of FeedbackTextQuestionDetails is the plain text of question text. However, as the recommendedLength was added, the plain text is not applicable any more. Therefore, in .json files and data store, there are both FeedbackTextQuestionDetails with and without recommendedLength information. We need to handle them separately

The script to change .json files can be found here

@xpdavid xpdavid self-assigned this Feb 9, 2019
@xpdavid xpdavid added the s.Ongoing The PR is being worked on by the author(s) label Feb 9, 2019
@xpdavid xpdavid self-requested a review February 12, 2019 13:13
@Adoby7 Adoby7 force-pushed the issue_9363_question_details branch 2 times, most recently from 2fbdf46 to e4c9c2a Compare February 12, 2019 15:09
@Adoby7 Adoby7 closed this Feb 12, 2019
@Adoby7 Adoby7 reopened this Feb 12, 2019
@Adoby7
Copy link
Contributor Author

Adoby7 commented Feb 12, 2019

Ready for review

Copy link
Contributor

@xpdavid xpdavid left a comment

Choose a reason for hiding this comment

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

Looks good

# 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)
Copy link
Contributor

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;
Copy link
Contributor

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");
Copy link
Contributor

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.

Copy link
Contributor

@xpdavid xpdavid left a comment

Choose a reason for hiding this comment

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

LGTM!

@xpdavid xpdavid added s.FinalReview The PR is ready for final review and removed s.Ongoing The PR is being worked on by the author(s) labels Feb 21, 2019
@xpdavid xpdavid requested a review from damithc February 21, 2019 13:15
Copy link
Member

@wkurniawan07 wkurniawan07 left a comment

Choose a reason for hiding this comment

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

Approving on behalf of @damithc

@xpdavid one remark for your attention

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.
Copy link
Member

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.

Copy link
Contributor

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

@wkurniawan07 wkurniawan07 added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.FinalReview The PR is ready for final review labels Feb 21, 2019
@xpdavid xpdavid merged commit 0c7fa8c into TEAMMATES:master Feb 22, 2019
@xpdavid xpdavid added the c.Task Other non-user-facing works, e.g. refactoring, adding tests label Feb 22, 2019
@Adoby7 Adoby7 deleted the issue_9363_question_details branch February 22, 2019 06:58
rrtheonlyone pushed a commit to rrtheonlyone/teammates that referenced this pull request Feb 24, 2019
…dbackQuestionAttributes (TEAMMATES#9410)

[TEAMMATES#9363] Replace questionMetaData with questionDetails in FeedbackQuestionAttributes (TEAMMATES#9410)
@wkurniawan07 wkurniawan07 added this to the V7.0.0-beta.0 milestone Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Task Other non-user-facing works, e.g. refactoring, adding tests s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants