Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/app/settings/settings.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ <h2>{{"PAGE_SETTINGS_USE_NUERMIC_KEYBOARD_FOR_GRIND_SIZE" | translate}}</h2>
</div>
</ion-checkbox>
</ion-item>
<ion-item>
<ion-item>
<ion-label position="stacked">{{"PAGE_SETTINGS_AVG_COST_PER_COFFEE_AT_CAFE" | translate}}</ion-label>
<ion-input type="number" (ngModelChange)="saveSettings();" [(ngModel)]="settings.avg_cost_per_coffee_at_cafe"></ion-input>
<ion-note>{{"PAGE_SETTINGS_AVG_COST_PER_COFFEE_AT_CAFE_DESCRIPTION" | translate}}</ion-note>
</ion-item>
</ion-item>
<ion-item>
<ion-select (ngModelChange)="saveSettings()" [(ngModel)]="settings.currency"
cancelText="{{'CANCEL'| translate }}" okText="{{'CHOOSE'| translate }}">
Expand Down
11 changes: 11 additions & 0 deletions src/app/statistic/statistic.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
</ion-card-content>
</ion-card>
</ion-col>
<ion-col class="ion-text-center" size="6">
<ion-card class="small-card" style="height: 100%;">
<ion-card-header class="card-background"
style="font-size: 1.2em;">{{uiStatistic.getMoneySavedOnCoffee() | number : '.0-2'}}&nbsp;
{{getCurrencySymbol()}}
</ion-card-header>
<ion-card-content>
{{"PAGE_STATISTICS_MONEY_SAVED_ON_COFFEE" | translate}}
</ion-card-content>
</ion-card>
</ion-col>
<ion-col class="ion-text-center" size="6">
<ion-card class="small-card" style="height: 100%;">
<ion-card-header class="card-background" style="font-size: 1.2em;">{{uiStatistic.getBrewsDrunk() | number : '.0'}}
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"PAGE_SETTINGS_CURRENCY": "Currency",
"PAGE_STATISTICS_DIFFERENT_PREPARATION_METHOD": "Preparation Methods",
"PAGE_STATISTICS_TOTAL_GROUND_BEANS": "Total beans ground",
"PAGE_STATISTICS_MONEY_SAVED_ON_COFFEE": "Money saved on coffee",
"PAGE_STATISTICS_MONEY_SPENT_FOR_COFFEE": "Money spent on beans",
"PAGE_STATISTICS_DRUNKEN_BREWS": "Total number of brews",
"PAGE_STATISTICS_BREW_PROCESSES": "Total brews",
Expand Down Expand Up @@ -1632,6 +1633,8 @@
"CUSTOM_REPEAT_PARAMETERS_DESCRIPTION": "Activate customized repeat?",
"PAGE_SETTINGS_USE_NUERMIC_KEYBOARD_FOR_GRIND_SIZE": "Numeric keyboard for grind setting?",
"PAGE_SETTINGS_USE_NUERMIC_KEYBOARD_FOR_GRIND_SIZE_DESCRIPTION": "Do you want use a numeric keyboard for the grind setting, instead of the using of the whole keyboard?",
"PAGE_SETTINGS_AVG_COST_PER_COFFEE_AT_CAFE": "Average cost per coffee at cafe",
"PAGE_SETTINGS_AVG_COST_PER_COFFEE_AT_CAFE_DESCRIPTION": "The average cost per coffee at a cafe",
"PREPARATION_DEVICE": {
"TYPE": {
"NONE": "None",
Expand Down
4 changes: 4 additions & 0 deletions src/classes/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export class Settings implements ISettings {
public refractometer_stay_connected: boolean;
public refractometer_log: boolean;

public avg_cost_per_coffee_at_cafe: number;

public currency: string;
public brew_display_bean_image: boolean;
public best_brew: boolean;
Expand Down Expand Up @@ -415,6 +417,8 @@ export class Settings implements ISettings {
this.refractometer_stay_connected = false;
this.refractometer_log = false;

this.avg_cost_per_coffee_at_cafe = 0;

this.currency = 'EUR';
this.brew_milliseconds_leading_digits = 3;
this.brew_display_bean_image = false;
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/settings/iSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ export interface ISettings {
refractometer_stay_connected: boolean;
refractometer_log: boolean;

avg_cost_per_coffee_at_cafe: number;

currency: string;
brew_display_bean_image: boolean;
best_brew: boolean;
Expand Down
7 changes: 7 additions & 0 deletions src/services/uiStatistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export class UIStatistic {
return this.uiBrewStorage.getAllEntries().length;
}

public getMoneySavedOnCoffee(): number {
const avg_cost_per_coffee_at_cafe = this.uiSettings.getSettings().avg_cost_per_coffee_at_cafe;
const numberOfCoffees = this.getBrewsDrunk();

return numberOfCoffees * avg_cost_per_coffee_at_cafe;
}

public getBeansCount(): number {
return this.uiBeanStorage.getAllEntries().length;
}
Expand Down