Skip to content

Commit

Permalink
Feature #8
Browse files Browse the repository at this point in the history
  • Loading branch information
graphefruit committed Nov 1, 2018
1 parent 2111b6d commit 0e87169
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 26 deletions.
2 changes: 2 additions & 0 deletions src/classes/brew/brew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Brew implements IBrew {
public method_of_preparation: string;
public bean: string;
public brew_temperature: number;
public brew_temperature_time:number;
public brew_time: number;
public brew_quantity: number;
public brew_quantity_type:BREW_QUANTITY_TYPES_ENUM;
Expand All @@ -44,6 +45,7 @@ export class Brew implements IBrew {
this.grind_weight = 0;
this.method_of_preparation = "";
this.bean = "";
this.brew_temperature_time = 0;
this.brew_temperature = 0;
this.brew_time = 0;
this.brew_quantity = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/classes/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {DefaultLastCoffeeParameters} from "./settingsDefaultLastCoffeeParameter"
export class Settings implements ISettings {
public brew_view: BREW_VIEW_ENUM;
public brew_time: boolean;
public brew_temperature_time:boolean;
public grind_size: boolean;
public grind_weight: boolean;
public method_of_preparation: boolean;
Expand All @@ -33,6 +34,7 @@ export class Settings implements ISettings {

constructor() {
this.brew_view = BREW_VIEW_ENUM.SINGLE_PAGE;
this.brew_temperature_time = false;
this.brew_time = true;
this.grind_size = true;
this.grind_weight = true;
Expand Down
6 changes: 4 additions & 2 deletions src/classes/settings/settingsDefaultLastCoffeeParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import {IDefaultLastCoffeeParameters} from "../../interfaces/settings/iDefaultLastCoffeeParameters";

export class DefaultLastCoffeeParameters implements IDefaultLastCoffeeParameters {
public brew_time: boolean;
public grind_size: boolean;
public brew_time: boolean;
public brew_temperature_time:boolean;
public grind_size: boolean;
public grind_weight: boolean;
public method_of_preparation: boolean;
public brew_quantity: boolean;
Expand All @@ -19,6 +20,7 @@ export class DefaultLastCoffeeParameters implements IDefaultLastCoffeeParameters

constructor() {
this.bean_type = true;
this.brew_temperature_time = false;
this.brew_time = true;
this.grind_size = true;
this.grind_weight = true;
Expand Down
2 changes: 1 addition & 1 deletion src/components/timer/timer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-item class="no-bottom-border item">
<ion-label stacked>Zeit</ion-label>
<ion-label stacked>{{ label }}</ion-label>
<ion-input [prevent-characters] type="number" [(ngModel)]="timer.seconds"></ion-input>
<button ion-button icon-left clear color="danger" small (click)="initTimer()" item-right
*ngIf="!timer.runTimer && (timer.hasStarted || timer.hasFinished) || timer.hasFinished">
Expand Down
5 changes: 4 additions & 1 deletion src/components/timer/timer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Input} from '@angular/core';
import {Component, EventEmitter, Input, Output,} from '@angular/core';
import {ITimer} from '../../interfaces/timer/iTimer';


Expand All @@ -8,7 +8,9 @@ import {ITimer} from '../../interfaces/timer/iTimer';
})
export class TimerComponent {

@Input() label:string;
@Input() timeInSeconds: number;
@Output() timerStarted =new EventEmitter();
public timer: ITimer;

constructor() {
Expand Down Expand Up @@ -44,6 +46,7 @@ export class TimerComponent {
startTimer() {
this.timer.hasStarted = true;
this.timer.runTimer = true;
this.timerStarted.emit();
this.timerTick();
}

Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/brew/iBrew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export interface IBrew {
* Inherits the brew temperature for a brew
*/
brew_temperature:number,
/**
* Inherits the temperature surfing time for the coffee-
*/
brew_temperature_time:number,
/**
* Inherits the brewing time for the coffee, shot-time, infusion-time etc.
*/
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/settings/iDefaultLastCoffeeParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export interface IDefaultLastCoffeeParameters {
//Properties
brew_temperature_time:boolean;
brew_time: boolean,
grind_size: boolean,
grind_weight: boolean,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/settings/iSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {IDefaultLastCoffeeParameters} from "./iDefaultLastCoffeeParameters";
export interface ISettings {
//Properties
brew_view:BREW_VIEW_ENUM,
brew_temperature_time:boolean,
brew_time: boolean,
grind_size: boolean,
grind_weight: boolean,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/brews/add/brews-add.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
</ion-option>
</ion-select>
</ion-item>
<timer #timer timeInSeconds="0" *ngIf="settings.brew_time === true"></timer>
<timer #brewTemperatureTime timeInSeconds="0" label="Temperatur Zeit" *ngIf="settings.brew_temperature_time === true"></timer>
<timer #timer timeInSeconds="0" label="Zeit" (timerStarted)="brewTimeStarted($event)" *ngIf="settings.brew_time === true"></timer>
<ion-item *ngIf="settings.coffee_blooming_time === true">
<ion-label stacked>Blooming-Zeit / Preinfusion</ion-label>
<ion-input [prevent-characters] [(ngModel)]="data.coffee_blooming_time" type="text"></ion-input>
Expand Down
59 changes: 38 additions & 21 deletions src/pages/brews/add/brews-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import {BREW_QUANTITY_TYPES_ENUM} from '../../../enums/brews/brewQuantityTypes';
})
export class BrewsAddModal {
@ViewChild('photoSlides') photoSlides: Slides;
@ViewChild(TimerComponent) timer: TimerComponent;
@ViewChild('timer') timer: TimerComponent;
@ViewChild('brewTemperatureTime') brewTemperatureTime: TimerComponent;


public data: Brew = new Brew();

Expand Down Expand Up @@ -64,11 +66,9 @@ export class BrewsAddModal {
this.data.method_of_preparation = this.method_of_preparations[0].config.uuid;




}

ionViewDidEnter(){
ionViewDidEnter() {
this.__loadLastBrew();
}

Expand All @@ -79,57 +79,62 @@ export class BrewsAddModal {
let lastBrew: Brew = brews[brews.length - 1];


if (this.settings.default_last_coffee_parameters.bean_type===true){
if (this.settings.default_last_coffee_parameters.bean_type === true) {
this.data.bean = lastBrew.bean;
}

if (this.settings.default_last_coffee_parameters.grind_size===true) {
if (this.settings.default_last_coffee_parameters.grind_size === true) {
this.data.grind_size = lastBrew.grind_size;
}
if (this.settings.default_last_coffee_parameters.grind_weight===true) {
if (this.settings.default_last_coffee_parameters.grind_weight === true) {
this.data.grind_weight = lastBrew.grind_weight;
}
if (this.settings.default_last_coffee_parameters.method_of_preparation===true) {
if (this.settings.default_last_coffee_parameters.method_of_preparation === true) {
this.data.method_of_preparation = lastBrew.method_of_preparation;
}
if (this.settings.default_last_coffee_parameters.brew_temperature===true) {
if (this.settings.default_last_coffee_parameters.brew_temperature === true) {
this.data.brew_temperature = lastBrew.brew_temperature;
}

if (this.timer){
if (this.settings.default_last_coffee_parameters.brew_time===true) {
debugger;
if (this.brewTemperatureTime) {
if (this.settings.default_last_coffee_parameters.brew_temperature_time === true) {
this.data.brew_temperature_time = lastBrew.brew_temperature_time;
this.brewTemperatureTime.setTime(this.data.brew_temperature_time);
}
}
if (this.timer) {
if (this.settings.default_last_coffee_parameters.brew_time === true) {
this.data.brew_time = lastBrew.brew_time;
this.timer.setTime(this.data.brew_time);
}
}

if (this.settings.default_last_coffee_parameters.brew_quantity===true) {
if (this.settings.default_last_coffee_parameters.brew_quantity === true) {
this.data.brew_quantity = lastBrew.brew_quantity;
this.data.brew_quantity_type = lastBrew.brew_quantity_type;
}
if (this.settings.default_last_coffee_parameters.coffee_type===true) {
if (this.settings.default_last_coffee_parameters.coffee_type === true) {
this.data.coffee_type = lastBrew.coffee_type;
}
if (this.settings.default_last_coffee_parameters.coffee_concentration===true) {
if (this.settings.default_last_coffee_parameters.coffee_concentration === true) {
this.data.coffee_concentration = lastBrew.coffee_concentration;
}
if (this.settings.default_last_coffee_parameters.coffee_first_drip_time===true) {
if (this.settings.default_last_coffee_parameters.coffee_first_drip_time === true) {
this.data.coffee_first_drip_time = lastBrew.coffee_first_drip_time;
}
if (this.settings.default_last_coffee_parameters.coffee_blooming_time===true) {
if (this.settings.default_last_coffee_parameters.coffee_blooming_time === true) {
this.data.coffee_blooming_time = lastBrew.coffee_blooming_time;
}


if (this.settings.default_last_coffee_parameters.rating===true) {
if (this.settings.default_last_coffee_parameters.rating === true) {
this.data.rating = lastBrew.rating;
}
if (this.settings.default_last_coffee_parameters.note===true) {
if (this.settings.default_last_coffee_parameters.note === true) {
this.data.note = lastBrew.note;
}



}
}
}
Expand All @@ -146,9 +151,14 @@ export class BrewsAddModal {
this.dismiss();
}

public brewTimeStarted(_event) {
if (this.brewTemperatureTime) {
this.brewTemperatureTime.pauseTimer();
}
}

public getTime(): number {
if (this.timer){
if (this.timer) {
return this.timer.getSeconds();
}
return 0;
Expand Down Expand Up @@ -199,6 +209,13 @@ export class BrewsAddModal {
}

public stopTimer() {
if (this.brewTemperatureTime) {
this.brewTemperatureTime.pauseTimer();
this.data.brew_temperature_time = this.brewTemperatureTime.getSeconds();
}
else {
this.data.brew_temperature_time = 0;
}
if (this.timer) {
this.timer.pauseTimer();
this.data.brew_time = this.timer.getSeconds();
Expand Down
1 change: 1 addition & 0 deletions src/pages/brews/brews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class BrewsPage {
{"VALUE": brew.getPreparation().name, "LABEL": "Zubereitungsmethode"},
{"VALUE": brew.getBean().name, "LABEL": "Bohne"},
{"VALUE": brew.brew_temperature, "LABEL": "Brühtemperatur"},
{"VALUE": brew.brew_temperature_time, "LABEL": "Temperatur Zeit"},
{"VALUE": brew.brew_time, "LABEL": "Brühzeit"},
{"VALUE": brew.brew_quantity, "LABEL": "Bezugsmenge"},
{"VALUE": brew.getBrewQuantityTypeName(), "LABEL": "Bezugsmenge-Typ"},
Expand Down
4 changes: 4 additions & 0 deletions src/pages/brews/details/brews-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<span class="header-label">Bohnen:</span><br/>
&nbsp;{{data.getBean().name}}
</ion-item>
<ion-item *ngIf="settings.brew_temperature_time === true">
<span class="header-label">Temperatur Zeit:</span><br/>
{{data.brew_temperature_time}}
</ion-item>
<ion-item *ngIf="settings.brew_time === true">
<span class="header-label">Zeit:</span><br/>
{{data.brew_time}}
Expand Down
4 changes: 4 additions & 0 deletions src/pages/brews/edit/brews-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
</ion-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label stacked>Temperatur Zeit</ion-label>
<ion-input [prevent-characters] [(ngModel)]="data.brew_temperature_time" type="text"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>Zeit</ion-label>
<ion-input [prevent-characters] [(ngModel)]="data.brew_time" type="text"></ion-input>
Expand Down
6 changes: 6 additions & 0 deletions src/pages/brews/table/brews-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
Brüh-<br/>
temperatur
</th>
<th *ngIf="settings.brew_temperature_time === true">
Temperatur Zeit
</th>
<th *ngIf="settings.brew_time === true">
Brühzeit
</th>
Expand Down Expand Up @@ -97,6 +100,9 @@
</td>
<td *ngIf="settings.brew_temperature === true">
{{ brew.brew_temperature}}
</td>
<td *ngIf="settings.brew_temperature_time === true">
{{ brew.brew_temperature_time}}
</td>
<td *ngIf="settings.brew_time === true">
{{ brew.brew_time}}
Expand Down
8 changes: 8 additions & 0 deletions src/pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
</ion-item>
<div *ngIf="settings.set_last_coffee_brew==true">
<ion-item-divider color="light">Welche Parameter sollen vorbelegt werden?</ion-item-divider>
<ion-item>
<ion-label>Temperatur Zeit</ion-label>
<ion-checkbox [(ngModel)]="settings.default_last_coffee_parameters.brew_temperature_time" (ngModelChange)="saveSettings($event)"></ion-checkbox>
</ion-item>
<ion-item>
<ion-label>Zeit</ion-label>
<ion-checkbox [(ngModel)]="settings.default_last_coffee_parameters.brew_time" (ngModelChange)="saveSettings($event)"></ion-checkbox>
Expand Down Expand Up @@ -100,6 +104,10 @@


<ion-item-divider color="light">Anzuzeigende Bezugsparameter</ion-item-divider>
<ion-item>
<ion-label>Temperatur Zeit</ion-label>
<ion-checkbox [(ngModel)]="settings.brew_temperature_time" (ngModelChange)="saveSettings($event)"></ion-checkbox>
</ion-item>
<ion-item>
<ion-label>Zeit</ion-label>
<ion-checkbox [(ngModel)]="settings.brew_time" (ngModelChange)="saveSettings($event)"></ion-checkbox>
Expand Down

0 comments on commit 0e87169

Please sign in to comment.