kotlin lints

This commit is contained in:
Milos Kozak 2023-08-27 11:36:51 +02:00
parent c6595e0a2a
commit 05556a4b52
3 changed files with 6 additions and 13 deletions

View file

@ -702,10 +702,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
@NonNull @Override
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean force, @NonNull PumpSync.TemporaryBasalType tbrType) {
getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute called with a rate of " + absoluteRate + " for " + durationInMinutes + " min.");
int unroundedPercentage = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
int unRoundedPercentage = (int) (absoluteRate / getBaseBasalRate() * 100);
int roundedPercentage = (int) (Math.round(absoluteRate / getBaseBasalRate() * 10) * 10);
if (unroundedPercentage != roundedPercentage) {
getAapsLogger().debug(LTag.PUMP, "Rounded requested rate " + unroundedPercentage + "% -> " + roundedPercentage + "%");
if (unRoundedPercentage != roundedPercentage) {
getAapsLogger().debug(LTag.PUMP, "Rounded requested rate " + unRoundedPercentage + "% -> " + roundedPercentage + "%");
}
return setTempBasalPercent(roundedPercentage, durationInMinutes, tbrType);

View file

@ -42,17 +42,13 @@ import info.nightscout.shared.interfaces.ResourceHelper;
import info.nightscout.shared.sharedPreferences.SP;
import info.nightscout.shared.utils.DateUtil;
import info.nightscout.shared.utils.T;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
@Singleton
@OpenForTesting
public class DanaRv2Plugin extends AbstractDanaRPlugin {
private final CompositeDisposable disposable = new CompositeDisposable();
private final AAPSLogger aapsLogger;
private final Context context;
private final ResourceHelper rh;
private final Constraints constraintChecker;
private final DetailedBolusInfoStorage detailedBolusInfoStorage;
private final TemporaryBasalStorage temporaryBasalStorage;
private final FabricPrivacy fabricPrivacy;
@ -233,7 +229,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
final boolean doHighTemp = absoluteRate > getBaseBasalRate();
int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
int percentRate = (int) (absoluteRate / getBaseBasalRate() * 100);
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
if (absoluteRate < 0.10d) percentRate = 0;
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo((double) percentRate, 10d);
@ -396,7 +392,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
if (danaPump.isExtendedInProgress()) {
sExecutionService.extendedBolusStop();
result.enacted(true).success(!danaPump.isExtendedInProgress()).isTempCancel(true);
} else {
} else {
result.success(true).enacted(false).comment(info.nightscout.core.ui.R.string.ok);
getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK");
}

View file

@ -38,13 +38,10 @@ import info.nightscout.rx.logging.LTag;
import info.nightscout.shared.interfaces.ResourceHelper;
import info.nightscout.shared.sharedPreferences.SP;
import info.nightscout.shared.utils.DateUtil;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
@Singleton
@OpenForTesting
public class DanaRPlugin extends AbstractDanaRPlugin {
private final CompositeDisposable disposable = new CompositeDisposable();
private final AAPSLogger aapsLogger;
private final Context context;
private final ResourceHelper rh;
@ -218,7 +215,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
final boolean doHighTemp = absoluteRate > getBaseBasalRate() && !useExtendedBoluses;
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
int percentRate = (int) (absoluteRate / getBaseBasalRate() * 100);
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
if (absoluteRate < 0.10d) percentRate = 0;
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo(percentRate, 10d);