* sanitize the timers a bit

This commit is contained in:
Dávid Danyi 2017-09-08 18:28:42 +02:00
parent 6494c5c75c
commit 0d628456c4
3 changed files with 19 additions and 20 deletions

View File

@ -86,15 +86,17 @@ export class AppComponent implements OnInit, OnDestroy {
let weekDay = now.getDay(); let weekDay = now.getDay();
// on weekdays // on weekdays
if (weekDay > 0 && weekDay < 6) { if (weekDay > 0 && weekDay < 6) {
if (now.getHours() == 9 && now.getMinutes() >= 14 && this.autoSwitchEnabled) { if(now.getHours() == 10) {
if (this.autoSwitchEnabled && now.getMinutes() > 14) {
this.navigateToPage(PAGE_KANBAN); this.navigateToPage(PAGE_KANBAN);
this.autoSwitchEnabled = false; this.autoSwitchEnabled = false;
} }
if (now.getHours() == 9 && now.getMinutes() >= 29 && !this.autoSwitchEnabled) { if (!this.autoSwitchEnabled && now.getMinutes() > 30) {
this.navigateToPage(PAGE_TSPINFO); this.navigateToPage(PAGE_TSPINFO);
this.autoSwitchEnabled = true; this.autoSwitchEnabled = true;
} }
} }
}
if (this.autoSwitchEnabled) { if (this.autoSwitchEnabled) {
let compareTimer: number = 0; let compareTimer: number = 0;
let switchTo: string = ''; let switchTo: string = '';

View File

@ -20,7 +20,7 @@ const WIP_LIMIT_VERIFICATION = 8;
const STYLE_HIDDEN = 'hidden'; const STYLE_HIDDEN = 'hidden';
const STYLE_VISIBLE = 'scroll'; const STYLE_VISIBLE = 'scroll';
const FUN_TIMER = 3000; const FUN_TIMER = 2000;
@Component({ @Component({
selector: 'app-kanban-board', selector: 'app-kanban-board',
@ -32,7 +32,7 @@ export class KanbanBoardComponent implements OnInit, OnDestroy {
private funTimer: Subscription; private funTimer: Subscription;
@HostBinding('style.overflow') hostOverflow = STYLE_HIDDEN; @HostBinding('style.overflow') hostOverflow = STYLE_HIDDEN;
public showSomeFun: boolean = true; public showSomeFun: boolean = false;
constructor(private titleService: Title, constructor(private titleService: Title,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -52,16 +52,14 @@ export class KanbanBoardComponent implements OnInit, OnDestroy {
this.kanbanBoard = data.kanbanBoard; this.kanbanBoard = data.kanbanBoard;
this.fun = data.fun; this.fun = data.fun;
}); });
this.lunchTime();
let timer0 = TimerObservable.create(FUN_TIMER, FUN_TIMER); let timer0 = TimerObservable.create(FUN_TIMER, FUN_TIMER);
this.funTimer = timer0.subscribe(() => { this.funTimer = timer0.subscribe(() => this.lunchTime.bind(this));
let now = new Date();
if((now.getHours() == 10 && now.getMinutes() > 28) || (now.getHours() == 11 && now.getMinutes() < 30)) {
this.showSomeFun = true;
} else {
this.showSomeFun = false;
} }
});
private lunchTime() {
let now = new Date();
this.showSomeFun = (now.getHours() == 11 && now.getMinutes() > 29) || (now.getHours() == 12 && now.getMinutes() < 31);
} }
ngOnDestroy() { ngOnDestroy() {

View File

@ -1,4 +1,3 @@
<div class="widget camera"> <div class="widget camera">
<img [src]="cameraUrls[0]"> <img *ngFor="let src of cameraUrls" [src]="src">
<img [src]="cameraUrls[1]">
</div> </div>