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] Delete redundant index #13095

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ private void migrateFeedbackQuestion(teammates.storage.sqlentity.FeedbackSession
oldResponses = ofy().load().type(FeedbackResponse.class)
.filter("feedbackQuestionId", oldQuestion.getId()).list();
}

if (oldResponses == null || oldResponses.size() == 0) {
log(String.format("No responses found for question %s %s in course %s", oldQuestion.getId(), oldQuestion.getQuestionNumber(), newSession.getCourse().getId()));
return;
}


for (FeedbackResponse oldResponse : oldResponses) {
Section newGiverSection = sectionNameToSectionMap.get(oldResponse.getGiverSection());
Section newRecipientSection = sectionNameToSectionMap.get(oldResponse.getRecipientSection());
Expand All @@ -340,6 +347,11 @@ private void migrateFeedbackResponse(teammates.storage.sqlentity.FeedbackQuestio

// cascade migrate response comments
List<FeedbackResponseComment> oldComments = responseIdToCommentsMap.get(oldResponse.getId());
if (oldComments == null) {
log(String.format("No comments found for response %s in course %s", oldResponse.getId(), oldResponse.getCourseId()));
return;
}

for (FeedbackResponseComment oldComment : oldComments) {
migrateFeedbackResponseComment(newResponse, oldComment, newGiverSection, newRecipientSection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ private void migrateFeedbackQuestion(teammates.storage.sqlentity.FeedbackSession
.filter("feedbackQuestionId", oldQuestion.getId()).list();
}
log(String.format("Feedback question %d has %d responses associated with it", oldQuestion.getQuestionNumber(), oldResponses.size()));

if (oldResponses == null || oldResponses.size() == 0) {
log(String.format("No responses found for question %s %s in course %s", oldQuestion.getId(), oldQuestion.getQuestionNumber(), newSession.getCourse().getId()));
return;
}

for (FeedbackResponse oldResponse : oldResponses) {
Section newGiverSection = sectionNameToSectionMap.get(oldResponse.getGiverSection());
Section newRecipientSection = sectionNameToSectionMap.get(oldResponse.getRecipientSection());
Expand All @@ -341,6 +347,11 @@ private void migrateFeedbackResponse(teammates.storage.sqlentity.FeedbackQuestio

// cascade migrate response comments
List<FeedbackResponseComment> oldComments = responseIdToCommentsMap.get(oldResponse.getId());
if (oldComments == null) {
log(String.format("No comments found for response %s in course %s", oldResponse.getId(), oldResponse.getCourseId()));
return;
}

for (FeedbackResponseComment oldComment : oldComments) {
migrateFeedbackResponseComment(newResponse, oldComment, newGiverSection, newRecipientSection);
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/teammates/storage/sqlentity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
* Represents a User.
*/
@Entity
@Table(name = "Users", uniqueConstraints = {
@UniqueConstraint(name = "Unique email and courseId", columnNames = { "email", "courseId" })
})
@Table(name = "Users")
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class User extends BaseEntity {
@Id
Expand Down