Skip to content

Commit

Permalink
implement query to remove older duplicate mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
MIPPL committed Aug 12, 2020
1 parent 80965b3 commit fb927e1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId = 'com.wagerrwallet'
minSdkVersion 23
targetSdkVersion 28
versionCode 279
versionName "279"
versionCode 280
versionName "280"
multiDexEnabled true

// Similar to other properties in the defaultConfig block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,26 @@ public void deleteTxByHash(Context app, String iso, String hash) {
}
}

public void deleteDuplicateMappings(Context app) {
Cursor cursor = null;
try {
database = openDatabase();
Log.e(TAG, "mapping transaction deleted" );
String QUERY = "delete from "+BRSQLiteHelper.BMTX_TABLE_NAME+" where " + BRSQLiteHelper.BMTX_COLUMN_ID + " in (select " + BRSQLiteHelper.BMTX_COLUMN_ID + " "
+ "from "+BRSQLiteHelper.BMTX_TABLE_NAME+" where "+ BRSQLiteHelper.BMTX_MAPPINGID +" in "
+ "(select "+ BRSQLiteHelper.BMTX_MAPPINGID +" from "+BRSQLiteHelper.BMTX_TABLE_NAME+" where " + BRSQLiteHelper.BMTX_NAMESPACEID +"=3 "
+ "group by " + BRSQLiteHelper.BMTX_NAMESPACEID + ", " + BRSQLiteHelper.BMTX_MAPPINGID + " "
+ "having count(*)>1) "
+ "and " + BRSQLiteHelper.BMTX_COLUMN_ID + " not in (select max(" + BRSQLiteHelper.BMTX_COLUMN_ID + ") from "+BRSQLiteHelper.BMTX_TABLE_NAME+" where "+ BRSQLiteHelper.BMTX_NAMESPACEID +"=3 "
+ "group by " + BRSQLiteHelper.BMTX_NAMESPACEID + ", " + BRSQLiteHelper.BMTX_MAPPINGID + " "
+ "having count(*)>1) )";

database.rawQuery(QUERY, null);
} finally {
closeDatabase();
}
}

public class BetMappingDupItem {
public long NamespaceID;
public long MappingID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,15 @@ public List<TxUiHolder> getTxUiHolders() {
}

protected void CleanChainBugs(Context app) {
BetMappingTxDataStore bm = BetMappingTxDataStore.getInstance(app);
// fake team mappings for ID 187.
BetMappingTxDataStore.getInstance(app).deleteTxByHash(app,"wgr", "cc89779e8e57d49e5e6d3e16ad57e648b19d86fb8f4714bc7df5abd3f92daa1d");
BetMappingTxDataStore.getInstance(app).deleteTxByHash(app,"wgr", "d8e1e8389bbcffe1c79cf11e2206281377e54b99219ec6ccec296c2adb8ad65f");
BetMappingTxDataStore.getInstance(app).deleteTxByHash(app,"wgr", "929972a7b2fdf55f6da7488ccaf7312fd5d22c4bca003ca089293c93f1c32917");
BetMappingTxDataStore.getInstance(app).deleteTxByHash(app,"wgr", "e4e3a4f782569fa3bf0135297942c8a1c791ec869ca036bf530ab95633d17815");
bm.deleteTxByHash(app,"wgr", "cc89779e8e57d49e5e6d3e16ad57e648b19d86fb8f4714bc7df5abd3f92daa1d");
bm.deleteTxByHash(app,"wgr", "d8e1e8389bbcffe1c79cf11e2206281377e54b99219ec6ccec296c2adb8ad65f");
bm.deleteTxByHash(app,"wgr", "929972a7b2fdf55f6da7488ccaf7312fd5d22c4bca003ca089293c93f1c32917");
bm.deleteTxByHash(app,"wgr", "e4e3a4f782569fa3bf0135297942c8a1c791ec869ca036bf530ab95633d17815");

// duplicate mappings
bm.deleteDuplicateMappings(app);
}

@Override
Expand Down

0 comments on commit fb927e1

Please sign in to comment.