Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
fix(pump-settings): pre-programmed basal rate always imported
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removed option to not import basal rate from pump settings
  • Loading branch information
burnedikt committed Jan 29, 2023
1 parent 05ca594 commit 9285c11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/adapter/pump-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ export function updateNightScoutProfileWithPumpSettings(
existingProfile: Profile,
pumpSettings: PumpSettings,
options: {
importBasalRate: boolean;
nightscoutProfileName: string;
} = {
importBasalRate: true,
nightscoutProfileName: config.nightscout.profileName,
}
): Profile {
Expand All @@ -88,9 +86,7 @@ export function updateNightScoutProfileWithPumpSettings(
...(existingProfile.store ?? {}),
[options.nightscoutProfileName]: {
...previousProfileConfig,
basal: options.importBasalRate
? pumpSettingsAsProfileConfig.basal
: previousProfileConfig.basal,
basal: pumpSettingsAsProfileConfig.basal,
},
},
};
Expand Down
7 changes: 1 addition & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,10 @@ export function startPumpSettingsSynchronization({
pollingIntervalMs = defaultPollingIntervalPumpSettings,
nightscoutProfileName = config.nightscout.profileName,
nightscoutClient = getNightscoutHttpClient(),
importBasalRate = true,
}: {
diasendUsername?: string;
diasendPassword?: string;
pollingIntervalMs?: number;
importBasalRate?: boolean;
} & NightscoutProfileOptions &
Partial<SynchronizeOptions> = {}) {
if (!nightscoutProfileName) {
Expand All @@ -196,7 +194,6 @@ export function startPumpSettingsSynchronization({
diasendPassword,
nightscoutProfileName,
nightscoutClient,
importBasalRate,
}),
"Pump Settings"
).loop();
Expand All @@ -211,13 +208,11 @@ async function synchronizePumpSettings({
diasendUsername = config.diasend.username,
diasendPassword = config.diasend.password,
nightscoutProfileName = config.nightscout.profileName,
importBasalRate = true,
nightscoutClient,
}: {
diasendUsername?: string;
diasendPassword?: string;
pollingIntervalMs?: number;
importBasalRate?: boolean;
} & NightscoutProfileOptions &
SynchronizeOptions) {
if (!diasendUsername) {
Expand All @@ -234,7 +229,7 @@ async function synchronizePumpSettings({
const updatedNightscoutProfile = updateNightScoutProfileWithPumpSettings(
await nightscoutClient.fetchProfile(),
pumpSettings,
{ importBasalRate, nightscoutProfileName }
{ nightscoutProfileName }
);
await nightscoutClient.updateProfile(updatedNightscoutProfile);
}
Expand Down

0 comments on commit 9285c11

Please sign in to comment.