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

[#12048] Migrate CreateFeedbackQuestionAction #12217

Conversation

hhdqirui
Copy link
Member

@hhdqirui hhdqirui commented Mar 16, 2023

Part of #12048

  • Remove the field questionText in FeedbackQuestion because initially question details are stored as a json string in questionText, and now we have all the different types of question inheriting FeedbackQuestion and the question details are stored in each subclass. The questionText in the parent class is redundant.
  • JsonConverter for questionDetails is changed to one not using generic as the one with generic is not working currently, and it will be updated in the future.
  • Data bundle for integration tests is updated to include some but not all feedback questions from the original data bundle. The rest is to be updated in the future.
  • One architecture test, testArchitecture_uiShouldNotTouchStorage is updated.
  • Integration test for this action is to be added after GetFeedbackQuestionAction is migrated.

@hhdqirui hhdqirui added the s.ToReview The PR is waiting for review(s) label Mar 16, 2023
Comment on lines 202 to 207
"questionType": "TEXT",
"questionText": "What is the best selling point of your product?"
},
"description": "This is a text question.",
"questionNumber": 1,
"questionType": "TEXT",
Copy link
Member

Choose a reason for hiding this comment

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

questionType seems to be repeated here. possible to remove this redundancy?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! Thanks for the catch!

Comment on lines 39 to 44
if (instructorDetailForCourse != null) {
gateKeeper.verifyAccessible(instructorDetailForCourse,
getNonNullFeedbackSession(feedbackSessionName, courseId),
Const.InstructorPermissions.CAN_MODIFY_SESSION);
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe we need to use the isCourseMigrated method here.

There's a case that's not considered here. After migration, datastore entity is still non-null. However, source of truth is now the sql entity, not the datastore one.

Comment on lines 64 to 74
getNonNullSqlFeedbackSession(feedbackSessionName, courseId),
request.getQuestionNumber(),
request.getQuestionDescription(),
request.getQuestionDetails().getQuestionType(),
request.getGiverType(),
request.getRecipientType(),
request.getNumberOfEntitiesToGiveFeedbackTo(),
request.getShowResponsesTo(),
request.getShowGiverNameTo(),
request.getShowRecipientNameTo(),
request.getQuestionDetails()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's time we consider a factory method for questions and responses. Can have a static method (maybe makeQuestion or similar?) in FeedbackQuestions that takes in the params and the question type and returns the subclass.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! Thanks for the advice!

@@ -41,6 +41,6 @@ public String toString() {
*/
@Converter
public static class FeedbackConstantSumResponseDetailsConverter
extends JsonConverter<FeedbackConstantSumResponseDetails> {
extends FeedbackQuestionDetailsConverter {
Copy link
Contributor

Choose a reason for hiding this comment

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

if i'm not wrong, these are response details, and not question details and hence the converter here is incorrect (need to create a FeedbackResponseDetailsConverter)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! Thanks for the catch!

@hhdqirui hhdqirui requested a review from samuelfangjw March 17, 2023 09:06
@samuelfangjw samuelfangjw merged commit db67441 into TEAMMATES:v9-migration Mar 17, 2023
@wkurniawan07 wkurniawan07 added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging c.Task Other non-user-facing works, e.g. refactoring, adding tests and removed s.ToReview The PR is waiting for review(s) labels Jan 21, 2024
@wkurniawan07 wkurniawan07 added this to the V9.0.0-beta.0 milestone Jan 21, 2024
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.

4 participants