Skip to content

Commit

Permalink
#825 - Add the open date of a bean bag if the parameter is set
Browse files Browse the repository at this point in the history
  • Loading branch information
graphefruit committed Oct 24, 2024
1 parent 3887d9d commit 3621971
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/app/brew/brew-add/brew-add.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export class BrewAddComponent implements OnInit, OnDestroy {

this.manageCaffeineConsumption();

await this.manageOpenDateForBean(addedBrewObj);

if (!this.hide_toast_message) {
this.uiToast.showInfoToast('TOAST_BREW_ADDED_SUCCESSFULLY');
}
Expand Down Expand Up @@ -381,6 +383,24 @@ export class BrewAddComponent implements OnInit, OnDestroy {
}
}

private async manageOpenDateForBean(addedBrewObj: Brew) {
//#825
try {
this.uiLog.log('Brew add - Step OpenDateForBean');
const bean = this.data.getBean();
if (bean && !bean.openDate) {
if (this.settings.bean_manage_parameters.openDate === true) {
if (this.brewBrewing.customCreationDate) {
bean.openDate = this.brewBrewing.customCreationDate;
} else {
bean.openDate = moment(new Date()).toISOString();
}
await this.uiBeanStorage.update(bean);
}
}
} catch (ex) {}
}

private manageUploadToVisualizer(addedBrewObj: Brew): void {
if (
this.settings.visualizer_active &&
Expand Down

0 comments on commit 3621971

Please sign in to comment.