Update models

This commit is contained in:
Hillel Coren 2021-01-17 10:17:24 +02:00
parent 780e50d1ab
commit 1adeed2fbf
1 changed files with 3 additions and 24 deletions

View File

@ -217,7 +217,6 @@ abstract class TaskEntity extends Object
timeLog: isRunning timeLog: isRunning
? '[[${(DateTime.now().millisecondsSinceEpoch / 1000).floor()},0]]' ? '[[${(DateTime.now().millisecondsSinceEpoch / 1000).floor()},0]]'
: '[]', : '[]',
isRunning: isRunning,
customValue1: '', customValue1: '',
customValue2: '', customValue2: '',
customValue3: '', customValue3: '',
@ -245,7 +244,6 @@ abstract class TaskEntity extends Object
..isChanged = false ..isChanged = false
..isDeleted = false ..isDeleted = false
..invoiceId = '' ..invoiceId = ''
..isRunning = false
..duration = 0 ..duration = 0
..timeLog = '[]'); ..timeLog = '[]');
@ -408,8 +406,7 @@ abstract class TaskEntity extends Object
return rebuild((b) => b return rebuild((b) => b
..isChanged = true ..isChanged = true
..timeLog = jsonEncode(taskTimes) ..timeLog = jsonEncode(taskTimes));
..isRunning = time.isRunning);
} }
TaskEntity updateTaskTime(TaskTime time, int index) { TaskEntity updateTaskTime(TaskTime time, int index) {
@ -418,18 +415,9 @@ abstract class TaskEntity extends Object
taskTimes[index] = time.asList; taskTimes[index] = time.asList;
bool isRunning = false;
if (taskTimes.isNotEmpty) {
final last = taskTimes.last as List;
if (last.length == 1 || (last.length == 2 && last[1] == 0)) {
isRunning = true;
}
}
return rebuild((b) => b return rebuild((b) => b
..isChanged = true ..isChanged = true
..timeLog = jsonEncode(taskTimes) ..timeLog = jsonEncode(taskTimes));
..isRunning = isRunning);
} }
TaskEntity deleteTaskTime(int index) { TaskEntity deleteTaskTime(int index) {
@ -438,18 +426,9 @@ abstract class TaskEntity extends Object
taskTimes.removeAt(index); taskTimes.removeAt(index);
bool isRunning = false;
if (taskTimes.isNotEmpty) {
final last = taskTimes.last as List;
if (last.length == 1 || (last.length == 2 && last[1] == 0)) {
isRunning = true;
}
}
return rebuild((b) => b return rebuild((b) => b
..isChanged = true ..isChanged = true
..timeLog = jsonEncode(taskTimes) ..timeLog = jsonEncode(taskTimes));
..isRunning = isRunning);
} }
double calculateAmount(double taskRate) => double calculateAmount(double taskRate) =>