diff --git a/package.json b/package.json
index 7d2e9e9..23652f4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "WorkTime",
- "version": "0.1.2",
+ "version": "0.1.3",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
diff --git a/src/app/time/time.page.html b/src/app/time/time.page.html
index 3b53d9b..b2d0bab 100644
--- a/src/app/time/time.page.html
+++ b/src/app/time/time.page.html
@@ -30,7 +30,7 @@
{{getTypeText(entry.type)}}
{{formatEntry(entry.registeredAt.getHours(), entry.registeredAt.getMinutes())}}
- {{generateSeparatorText(data[index - 1], entry)}}
+ {{generateSeparatorText(today[index - 1], entry)}}
diff --git a/src/app/time/time.page.ts b/src/app/time/time.page.ts
index 6fa1845..b1f883f 100644
--- a/src/app/time/time.page.ts
+++ b/src/app/time/time.page.ts
@@ -25,6 +25,7 @@ import {FormsModule} from "@angular/forms";
})
export class TimePage {
public data: TimeEntry[] = [];
+ public today: TimeEntry[] = [];
public shouldAnimate: boolean[] = [];
public currentAction: TimeType = 'login';
@ViewChild('createModal') modal: IonModal | undefined;
@@ -53,7 +54,8 @@ export class TimePage {
public getEntriesOfToday(): TimeEntry[] {
const today = new Date(this.currentDate || Date.now()).toLocaleDateString();
- return this.data.filter(entry => entry.registeredAt.toLocaleDateString() === today);
+ this.today = this.data.filter(entry => entry.registeredAt.toLocaleDateString() === today);
+ return this.today;
}
public getTypeText(type: TimeType): string {
@@ -119,11 +121,10 @@ export class TimePage {
}
private updateCurrentAction(): void {
- const today = this.getEntriesOfToday();
- if (today.length == 0) {
+ if (this.data.length == 0) {
this.currentAction = 'login';
}else {
- const lastAction = today[today.length - 1].type;
+ const lastAction = this.data[this.data.length - 1].type;
switch (lastAction) {
case "start-drive":
@@ -188,8 +189,8 @@ export class TimePage {
this.shouldAnimate.push(false);
}
- this.updateCurrentAction();
this.saveData();
+ this.updateCurrentAction();
this.modal?.dismiss(null, 'submit');
this.modalDate = undefined;
}