Feature: Es wird beachtet, dass es schon vorhandene Daten geben kann

This commit is contained in:
2022-01-10 14:16:41 +01:00
parent d133cb017b
commit cf50607f43
3 changed files with 49 additions and 36 deletions
+4 -10
View File
@@ -9,20 +9,14 @@
export let newRecord = false
const Controller = {
'saveRecord': () => {
if (newRecord === true) {
WorkingHoursRepository.add(activeRecord).then(() => {
Controller.nextDay()
});
} else {
WorkingHoursRepository.update(activeRecord.workingDay, activeRecord).then(() => {
Controller.nextDay()
});
}
WorkingHoursRepository.addOrUpdate(activeRecord.workingDay, activeRecord).then(() => {
Controller.nextDay()
});
},
'nextDay': () => {
let actDate = new TimekeepingDate(activeRecord.workingDay)
let nextDay = actDate.getNextDay()
activeRecord = {workingTime: '00:00:00', workingDay: nextDay.getDateString()}
activeRecord = WorkingHoursRepository.readOrNew(nextDay.getDateString())
},
'cancelActiveRecord': () => {
activeRecord = null;
+1 -2
View File
@@ -21,8 +21,7 @@
},
'newRecord': () => {
const actDate = new TimekeepingDate()
activeRecord = {workingTime: '00:00:00', workingDay: actDate.getDateString()}
newRecord = true;
activeRecord = WorkingHoursRepository.readOrNew(actDate.getDateString())
},
'selectActiveRecord': record => WorkingHoursRepository.read(record.workingDay).then(data => {
if (data === null) {