Properly fixed analysis day refreshing
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "WorkTime",
|
"name": "WorkTime",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"author": "Ionic Framework",
|
"author": "Ionic Framework",
|
||||||
"homepage": "https://ionicframework.com/",
|
"homepage": "https://ionicframework.com/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label>Tag</ion-label>
|
<ion-label>Tag</ion-label>
|
||||||
<ion-datetime-button datetime="current-datetime"></ion-datetime-button>
|
<ion-datetime-button datetime="current-datetime-analysis"></ion-datetime-button>
|
||||||
|
|
||||||
<ion-modal [keepContentsMounted]="true">
|
<ion-modal [keepContentsMounted]="true">
|
||||||
<ng-template>
|
<ng-template>
|
||||||
<ion-datetime id="current-datetime" presentation="date" [(ngModel)]="currentDate"></ion-datetime>
|
<ion-datetime id="current-datetime-analysis" presentation="date" [(ngModel)]="currentDate" (ngModelChange)="updateCurrentData()"></ion-datetime>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ion-modal>
|
</ion-modal>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -49,26 +49,12 @@ export class AnalysisPage {
|
|||||||
@ViewChild('chart') chartRef: ElementRef;
|
@ViewChild('chart') chartRef: ElementRef;
|
||||||
private chart: any;
|
private chart: any;
|
||||||
|
|
||||||
private changeListener: any;
|
|
||||||
|
|
||||||
constructor(private time: TimeService) {
|
constructor(private time: TimeService) {
|
||||||
addIcons({briefcase, pizza, card})
|
addIcons({briefcase, pizza, card})
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidEnter() {
|
ionViewDidEnter() {
|
||||||
this.updateCurrentData();
|
this.updateCurrentData();
|
||||||
|
|
||||||
let lastDate: any = undefined;
|
|
||||||
this.changeListener = setInterval(() => {
|
|
||||||
if (this.currentDate != lastDate) {
|
|
||||||
lastDate = this.currentDate;
|
|
||||||
this.updateCurrentData();
|
|
||||||
}
|
|
||||||
}, 200)
|
|
||||||
}
|
|
||||||
|
|
||||||
ionViewDidLeave() {
|
|
||||||
clearInterval(this.changeListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCurrentData() {
|
public updateCurrentData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user