-
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
[#12048] Migrate CreateFeedbackQuestionAction #12217
[#12048] Migrate CreateFeedbackQuestionAction #12217
Conversation
"questionType": "TEXT", | ||
"questionText": "What is the best selling point of your product?" | ||
}, | ||
"description": "This is a text question.", | ||
"questionNumber": 1, | ||
"questionType": "TEXT", |
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.
questionType seems to be repeated here. possible to remove this redundancy?
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! Thanks for the catch!
if (instructorDetailForCourse != null) { | ||
gateKeeper.verifyAccessible(instructorDetailForCourse, | ||
getNonNullFeedbackSession(feedbackSessionName, courseId), | ||
Const.InstructorPermissions.CAN_MODIFY_SESSION); | ||
return; | ||
} |
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 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.
getNonNullSqlFeedbackSession(feedbackSessionName, courseId), | ||
request.getQuestionNumber(), | ||
request.getQuestionDescription(), | ||
request.getQuestionDetails().getQuestionType(), | ||
request.getGiverType(), | ||
request.getRecipientType(), | ||
request.getNumberOfEntitiesToGiveFeedbackTo(), | ||
request.getShowResponsesTo(), | ||
request.getShowGiverNameTo(), | ||
request.getShowRecipientNameTo(), | ||
request.getQuestionDetails() |
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.
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.
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.
Sure! Thanks for the advice!
@@ -41,6 +41,6 @@ public String toString() { | |||
*/ | |||
@Converter | |||
public static class FeedbackConstantSumResponseDetailsConverter | |||
extends JsonConverter<FeedbackConstantSumResponseDetails> { | |||
extends FeedbackQuestionDetailsConverter { |
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.
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
)
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! Thanks for the catch!
Part of #12048
questionText
inFeedbackQuestion
because initially question details are stored as a json string inquestionText
, and now we have all the different types of question inheritingFeedbackQuestion
and the question details are stored in each subclass. ThequestionText
in the parent class is redundant.JsonConverter
forquestionDetails
is changed to one not using generic as the one with generic is not working currently, and it will be updated in the future.testArchitecture_uiShouldNotTouchStorage
is updated.GetFeedbackQuestionAction
is migrated.