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] Fix getSessionResultAction bugs #13023

Merged
merged 15 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "Add changes (#12965)"
This reverts commit 1292dbe.
  • Loading branch information
mingyuanc committed Apr 14, 2024
commit 671af226e739a35b1e9c11692c25ede703fc399f
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
import com.google.cloud.datastore.QueryResults;
import com.googlecode.objectify.cmd.Query;

import jakarta.persistence.TypedQuery;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.Root;

// import jakarta.persistence.criteria.CriteriaDelete;

import teammates.client.connector.DatastoreClient;
Expand Down Expand Up @@ -131,27 +126,6 @@ private void doMigration(teammates.storage.entity.Account entity) {
* Migrates the entity.
*/
protected void migrateEntity(teammates.storage.entity.Account oldAccount) {
HibernateUtil.beginTransaction();

CriteriaBuilder cb = HibernateUtil.getCriteriaBuilder();
CriteriaQuery<teammates.storage.sqlentity.Account> cr = cb.createQuery(
teammates.storage.sqlentity.Account.class);
Root<teammates.storage.sqlentity.Account> root = cr.from(teammates.storage.sqlentity.Account.class);
cr.select(root).where(cb.equal(root.get("googleId"), oldAccount.getGoogleId()));

TypedQuery<teammates.storage.sqlentity.Account> query = HibernateUtil.createQuery(cr);


boolean isEntityInDb = query.getResultList().size() != 0;
HibernateUtil.commitTransaction();

// In db, but somehow not set as migrated.
if (isEntityInDb) {
oldAccount.setMigrated(true);
entitiesOldAccountSavingBuffer.add(oldAccount);
return;
};

teammates.storage.sqlentity.Account newAccount = new teammates.storage.sqlentity.Account(
oldAccount.getGoogleId(),
oldAccount.getName(),
Expand All @@ -162,6 +136,7 @@ protected void migrateEntity(teammates.storage.entity.Account oldAccount) {
oldAccount.setMigrated(true);
entitiesOldAccountSavingBuffer.add(oldAccount);
migrateReadNotification(oldAccount, newAccount);

}

private void migrateReadNotification(teammates.storage.entity.Account oldAccount,
Expand Down
Loading