Task item details
This commit is contained in:
parent
bb61a2ef6a
commit
a269bd969c
|
|
@ -121,7 +121,9 @@ abstract class TaskTime implements Built<TaskTime, TaskTimeBuilder> {
|
||||||
Duration get duration => (endDate ?? DateTime.now()).difference(startDate);
|
Duration get duration => (endDate ?? DateTime.now()).difference(startDate);
|
||||||
|
|
||||||
List<dynamic> get asList {
|
List<dynamic> get asList {
|
||||||
final startTime = (startDate.millisecondsSinceEpoch / 1000).floor();
|
final startTime = startDate != null
|
||||||
|
? (startDate.millisecondsSinceEpoch / 1000).floor()
|
||||||
|
: 0;
|
||||||
var endTime =
|
var endTime =
|
||||||
endDate != null ? (endDate.millisecondsSinceEpoch / 1000).floor() : 0;
|
endDate != null ? (endDate.millisecondsSinceEpoch / 1000).floor() : 0;
|
||||||
|
|
||||||
|
|
@ -148,7 +150,8 @@ abstract class TaskTime implements Built<TaskTime, TaskTimeBuilder> {
|
||||||
|
|
||||||
bool get isRunning => endDate == null;
|
bool get isRunning => endDate == null;
|
||||||
|
|
||||||
bool get isEmpty => startDate == null && endDate == null;
|
bool get isEmpty =>
|
||||||
|
startDate == null && endDate == null && description.isEmpty;
|
||||||
|
|
||||||
Map<String, Duration> getParts() {
|
Map<String, Duration> getParts() {
|
||||||
final localStartDate = startDate.toLocal();
|
final localStartDate = startDate.toLocal();
|
||||||
|
|
@ -522,24 +525,21 @@ abstract class TaskEntity extends Object
|
||||||
startDate = (taskItem[0]).round();
|
startDate = (taskItem[0]).round();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startDate != 0) {
|
if (taskItem[1] == false || taskItem[1] == null) {
|
||||||
if (taskItem[1] == false || taskItem[1] == null) {
|
endDate = 0;
|
||||||
endDate = 0;
|
} else {
|
||||||
} else {
|
endDate = (taskItem[1]).round();
|
||||||
endDate = (taskItem[1]).round();
|
|
||||||
}
|
|
||||||
|
|
||||||
final taskTime = TaskTime(
|
|
||||||
startDate: convertTimestampToDate(startDate).toUtc(),
|
|
||||||
endDate: (endDate ?? 0) > 0
|
|
||||||
? convertTimestampToDate(endDate).toUtc()
|
|
||||||
: null,
|
|
||||||
description: taskItem.length >= 3 ? taskItem[2] : '',
|
|
||||||
isBillable: taskItem.length >= 4 ? taskItem[3] : true,
|
|
||||||
);
|
|
||||||
|
|
||||||
details.add(taskTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final taskTime = TaskTime(
|
||||||
|
startDate: convertTimestampToDate(startDate).toUtc(),
|
||||||
|
endDate:
|
||||||
|
(endDate ?? 0) > 0 ? convertTimestampToDate(endDate).toUtc() : null,
|
||||||
|
description: taskItem.length >= 3 ? taskItem[2] : '',
|
||||||
|
isBillable: taskItem.length >= 4 ? taskItem[3] : true,
|
||||||
|
);
|
||||||
|
|
||||||
|
details.add(taskTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (sort) {
|
if (sort) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue