Skip to content

Commit

Permalink
added DeviceStatus Collection Name since the hardcoded collection nam…
Browse files Browse the repository at this point in the history
…e might be an issue for people that run multiple sites in the same db
  • Loading branch information
Jason Calabrese committed Sep 8, 2014
1 parent 9e6c241 commit 2774a22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ private void populateLegacyAPIEntry(JSONObject json, EGVRecord record) throws Ex
private void doMongoUpload(SharedPreferences prefs, EGVRecord... records) {

String dbURI = prefs.getString("MongoDB URI", null);
String collectionName = prefs.getString("Collection Name", null);
String collectionName = prefs.getString("Collection Name", "entries");
String dsCollectionName = prefs.getString("DeviceStatus Collection Name", "devicestatus");

if (dbURI != null && collectionName != null) {
try {
Expand All @@ -244,7 +245,7 @@ private void doMongoUpload(SharedPreferences prefs, EGVRecord... records) {
dexcomData.update(testData, testData, true, false, WriteConcern.UNACKNOWLEDGED);
}

DBCollection dsCollection = db.getCollection("devicestatus");
DBCollection dsCollection = db.getCollection(dsCollectionName);
//Uploading devicestatus
BasicDBObject devicestatus = new BasicDBObject();
devicestatus.put("uploaderBattery", DexcomG4Activity.batLevel);
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@
android:title="Collection Name"
android:key="Collection Name"
android:dialogTitle="Enter Collection Name"
android:dialogMessage="This is the name of the collection where the CGM data will be stored">
android:dialogMessage="This is the name of the collection where the CGM data will be stored"
android:defaultValue="entries">
</EditTextPreference>
<EditTextPreference
android:dependency="EnableMongoUpload"
android:title="DeviceStatus Collection Name"
android:key="DeviceStatus Collection Name"
android:dialogTitle="Enter DeviceStatus Collection Name"
android:dialogMessage="This is the name of the collection where the battery and other device data will be stored"
android:defaultValue="devicestatus">
</EditTextPreference>
<SwitchPreference
android:title="Wifi Hack"
Expand Down

0 comments on commit 2774a22

Please sign in to comment.