Clean up assigning sourcePlugin, filtered properties.
This commit is contained in:
parent
940d58fc79
commit
906cc8a76a
6 changed files with 8 additions and 4 deletions
|
@ -71,7 +71,7 @@ public class SourceDexcomG5Plugin extends PluginBase implements BgSourceInterfac
|
|||
bgReading.date = json.getLong("m_time") * 1000L;
|
||||
bgReading.raw = 0;
|
||||
bgReading.filtered = true;
|
||||
bgReading.sourcePlugin = SourceDexcomG5Plugin.getPlugin().getName();
|
||||
bgReading.sourcePlugin = getName();
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
if (isNew) {
|
||||
bgReadings.add(bgReading);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SourceGlimpPlugin extends PluginBase implements BgSourceInterface {
|
|||
bgReading.date = bundle.getLong("myTimestamp");
|
||||
bgReading.raw = 0;
|
||||
bgReading.filtered = false;
|
||||
bgReading.sourcePlugin = SourceGlimpPlugin.getPlugin().getName();
|
||||
bgReading.sourcePlugin = getName();
|
||||
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
return isNew ? Lists.newArrayList(bgReading) : Collections.emptyList();
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SourceMM640gPlugin extends PluginBase implements BgSourceInterface
|
|||
bgReading.date = json_object.getLong("date");
|
||||
bgReading.raw = json_object.getDouble("sgv");
|
||||
bgReading.filtered = true;
|
||||
bgReading.sourcePlugin = SourceMM640gPlugin.getPlugin().getName();
|
||||
bgReading.sourcePlugin = getName();
|
||||
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
if (isNew) {
|
||||
|
|
|
@ -65,6 +65,8 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject sgvJson = jsonArray.getJSONObject(i);
|
||||
BgReading bgReading = new BgReading(new NSSgv(sgvJson));
|
||||
bgReading.filtered = false;
|
||||
bgReading.sourcePlugin = getName();
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
||||
if (isNew) {
|
||||
sgvs.add(bgReading);
|
||||
|
|
|
@ -66,6 +66,8 @@ public class SourcePoctechPlugin extends PluginBase implements BgSourceInterface
|
|||
bgReading.direction = json.getString("direction");
|
||||
bgReading.date = json.getLong("date");
|
||||
bgReading.raw = json.getDouble("raw");
|
||||
bgReading.filtered = false;
|
||||
bgReading.sourcePlugin = getName();
|
||||
if (JsonHelper.safeGetString(json, "utils", Constants.MGDL).equals("mmol/L"))
|
||||
bgReading.value = bgReading.value * Constants.MMOLL_TO_MGDL;
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
|
|
|
@ -47,8 +47,8 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
|
|||
bgReading.direction = bundle.getString(Intents.EXTRA_BG_SLOPE_NAME);
|
||||
bgReading.date = bundle.getLong(Intents.EXTRA_TIMESTAMP);
|
||||
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW);
|
||||
bgReading.sourcePlugin = SourceXdripPlugin.getPlugin().getName();
|
||||
bgReading.filtered = Objects.equals(bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION), "G5 Native");
|
||||
bgReading.sourcePlugin = getName();
|
||||
|
||||
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, getName());
|
||||
return isNew ? Lists.newArrayList(bgReading) : Collections.emptyList();
|
||||
|
|
Loading…
Reference in a new issue