Commit 95e0f85f authored by Roberta's avatar Roberta

make sure no duplicates occur

parent 5c953be0
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="imageWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="imageAssetPanel">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="actionbar">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/snap/android-studio/47/android-studio/plugins/android/lib/android.jar!/images/material_design_icons/communication/ic_email_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputName" value="ic_recv" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputIconType" value="ACTIONBAR" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -43,7 +43,7 @@ import java.util.List;
*
**/
public class EncounterBasedCommunication {
public static final long CHANGE_EPOCH_TIME = 15*60000;
public static final long CHANGE_EPOCH_TIME = 2*60000;
public static final long SCAN_BATCH_INTERVAL = (long) (2 * 60000);
public static final int REQUEST_ENABLE_BT = 1;
public static final int REQUEST_ACCESS_FINE_LOCATION = 2;
......
......@@ -62,6 +62,7 @@ public class EncounterHistoryAPM extends AggregatePersistenceModel {
Log.v("PersistenceModel", "Creating table " + model.getTableName());
sb.append("CREATE TABLE IF NOT EXISTS ").append(model.getTableName()).append(" (");
sb.append(Utils.collectionToStringV2(model.getColumns(), ","));
sb.append(model.getUnique());
sb.append(")");
db.execSQL(sb.toString());
}
......
......@@ -253,7 +253,9 @@ public class EncounterEntriesBridge extends AbstractEncountersBridge<MEncounterE
String whereClause = "HEX(" + PEncounterEntries.Columns.encounterID + ") = ?";
String[] selectArgs = new String[] {eid.toString()};
int updatedRows = context.getContentResolver().update(EncounterHistoryAPM.getContentURI(EncounterHistoryAPM.encounterEntries), values, whereClause, selectArgs);
Utils.myAssert(updatedRows == 1);
if (updatedRows != 1) {
Log.e(TAG, "UPDATED " + updatedRows + " ROWS WITH EID " + eid.toString());
}
}
public List<MEncounterEntry> getEntriesToPostForLinking() {
......
......@@ -13,4 +13,5 @@ public abstract class DBModel {
public abstract String getTableName();
public abstract List<DBColumn> getColumns();
public abstract List<DBValue> getValues();
public String getUnique() {return "";}
}
......@@ -133,6 +133,11 @@ public class DBEncounterEntries extends DBModel {
return values;
}
@Override
public String getUnique() {
return ", UNIQUE(" + Columns.myNonce + "," + Columns.receivedNonce + ")";
}
/*public static DBEncounterEntries fromString(String values) {
String[] vals = values.split("\n");
......
......@@ -60,7 +60,8 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.+'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'net.openid:appauth:0.3.0'
implementation 'org.mpisws:ebclibrary:0.1.0.1'
implementation 'pub.devrel:easypermissions:0.3.0'
......
{
application: {
ebcKey: '2e5a1cc8-5eab-4dbd-8d6d-6a84eab23374'
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment