revert dev changes

This commit is contained in:
Roumen Georgiev 2018-11-06 11:40:08 +02:00
parent 43a61f312a
commit 707a9e62d8
5 changed files with 19 additions and 27 deletions

View file

@ -9,32 +9,33 @@ var tempBasalFunctions = {};
tempBasalFunctions.getMaxSafeBasal = function getMaxSafeBasal(profile) {
var max_daily_safety_multiplier = (isNaN(profile.max_daily_safety_multiplier) || profile.max_daily_safety_multiplier == null) ? 3 : profile.max_daily_safety_multiplier;
var current_basal_safety_multiplier = (isNaN(profile.current_basal_safety_multiplier) || profile.current_basal_safety_multiplier == null) ? 4 : profile.current_basal_safety_multiplier;
var max_daily_safety_multiplier = (isNaN(profile.max_daily_safety_multiplier) || profile.max_daily_safety_multiplier == null) ? 3 : profile.max_daily_safety_multiplier;
var current_basal_safety_multiplier = (isNaN(profile.current_basal_safety_multiplier) || profile.current_basal_safety_multiplier == null) ? 4 : profile.current_basal_safety_multiplier;
return Math.min(profile.max_basal, max_daily_safety_multiplier * profile.max_daily_basal, current_basal_safety_multiplier * profile.current_basal);
return Math.min(profile.max_basal, max_daily_safety_multiplier * profile.max_daily_basal, current_basal_safety_multiplier * profile.current_basal);
};
tempBasalFunctions.setTempBasal = function setTempBasal(rate, duration, profile, rT, currenttemp) {
//var maxSafeBasal = Math.min(profile.max_basal, 3 * profile.max_daily_basal, 4 * profile.current_basal);
var maxSafeBasal = tempBasalFunctions.getMaxSafeBasal(profile);
var round_basal = require('./round-basal');
var round_basal = require('./round-basal');
if (rate < 0) {
rate = 0;
} else if (rate > maxSafeBasal) {
} // if >30m @ 0 required, zero temp will be extended to 30m instead
else if (rate > maxSafeBasal) {
rate = maxSafeBasal;
}
var suggestedRate = round_basal(rate, profile);
if (typeof(currenttemp) !== 'undefined' && typeof(currenttemp.duration) !== 'undefined' && typeof(currenttemp.rate) !== 'undefined' && currenttemp.duration > (duration-10) && currenttemp.duration <= 120 && suggestedRate <= currenttemp.rate * 1.2 && suggestedRate >= currenttemp.rate * 0.8 && duration > 0 ) {
if (typeof(currenttemp) !== 'undefined' && typeof(currenttemp.duration) !== 'undefined' && typeof(currenttemp.rate) !== 'undefined' && currenttemp.duration > (duration-10) && currenttemp.duration <= 120 && suggestedRate <= currenttemp.rate * 1.2 && suggestedRate >= currenttemp.rate * 0.8) {
rT.reason += " "+currenttemp.duration+"m left and " + currenttemp.rate + " ~ req " + suggestedRate + "U/hr: no temp required";
return rT;
}
if (suggestedRate === profile.current_basal) {
if (profile.skip_neutral_temps === true) {
if (profile.skip_neutral_temps) {
if (typeof(currenttemp) !== 'undefined' && typeof(currenttemp.duration) !== 'undefined' && currenttemp.duration > 0) {
reason(rT, 'Suggested rate is same as profile rate, a temp basal is active, canceling current temp');
rT.duration = 0;
@ -57,4 +58,4 @@ tempBasalFunctions.setTempBasal = function setTempBasal(rate, duration, profile,
}
};
module.exports = tempBasalFunctions;
module.exports = tempBasalFunctions;

View file

@ -156,12 +156,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
log.info("Do nothing for downgrading...");
log.debug("oldVersion: {}, newVersion: {}", oldVersion, newVersion);
}
public int getOldVersion() {
return oldVersion;
}
@ -1657,4 +1651,4 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
// ---------------- Food handling ---------------
}
}

View file

@ -107,9 +107,9 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
@Override
public void onPause() {
running = false;
super.onPause();
MainApp.unsubscribe(this);
running = false;
if (L.isEnabled(L.UI))
log.debug("onPause");
}
@ -173,12 +173,10 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(() -> {
if (L.isEnabled(L.UI))
log.debug("executing");
try {
if (running) {
if (L.isEnabled(L.UI))
log.debug("executing");
dismiss();
}
dismiss();
} catch (Exception e) {
log.error("Unhandled exception", e);
}
@ -190,4 +188,4 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
});
t.start();
}
}
}

View file

@ -1364,7 +1364,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// Sensitivity
if (sensitivityView != null) {
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensData("Overview");
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("Overview");
if (autosensData != null)
sensitivityView.setText(String.format("%.0f%%", autosensData.autosensResult.ratio * 100));
else
@ -1525,4 +1525,4 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
}
}
}

View file

@ -807,7 +807,7 @@
<string name="hour">hodin</string>
<string name="day">dní</string>
<string name="week">týdnů</string>
<string name="time_plural"></string>
<string name="time_plural"> </string>
<string name="insight_keepalive_format_string">%1$d vyprší %2$s</string>
<string name="insight_keep_alive_status">Stav keep-alive</string>
<string name="statistics">Statistika</string>
@ -1052,7 +1052,6 @@
<string name="insulinlimitviolation">Překročen limit inzulínu</string>
<string name="loop_openmode_min_change">Minimální změna pro výzvu [%]</string>
<string name="loop_openmode_min_change_summary">Smyčka vytvoří novou žádost o změnu pouze v případě, že změna je větší než tato hodnota. Výchozí hodnota je 20 %</string>
<string name="pairfirst">Spárujte pumpu s telefonem!</string>
<plurals name="objective_days">
<item quantity="one">%1$d den</item>
<item quantity="few">%1$d dnů</item>
@ -1071,4 +1070,4 @@
<item quantity="many">%1$d minut</item>
<item quantity="other">%1$d minut</item>
</plurals>
</resources>
</resources>