* 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,13 +86,15 @@ export class AppComponent implements OnInit, OnDestroy {
let weekDay = now.getDay();
// on weekdays
if (weekDay > 0 && weekDay < 6) {
if (now.getHours() == 9 && now.getMinutes() >= 14 && this.autoSwitchEnabled) {
this.navigateToPage(PAGE_KANBAN);
this.autoSwitchEnabled = false;
}
if (now.getHours() == 9 && now.getMinutes() >= 29 && !this.autoSwitchEnabled) {
this.navigateToPage(PAGE_TSPINFO);
this.autoSwitchEnabled = true;
if(now.getHours() == 10) {
if (this.autoSwitchEnabled && now.getMinutes() > 14) {
this.navigateToPage(PAGE_KANBAN);
this.autoSwitchEnabled = false;
}
if (!this.autoSwitchEnabled && now.getMinutes() > 30) {
this.navigateToPage(PAGE_TSPINFO);
this.autoSwitchEnabled = true;
}
}
}
if (this.autoSwitchEnabled) {

View File

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

View File

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