• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

asartalo / diligence / 8935810209

03 May 2024 07:50AM UTC coverage: 92.467% (-0.4%) from 92.842%
8935810209

push

github

web-flow
chore(merge): pull request #45 from main

chore(merge): merge latest from main

929 of 1018 new or added lines in 66 files covered. (91.26%)

1 existing line in 1 file now uncovered.

1964 of 2124 relevant lines covered (92.47%)

2.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.95
/lib/models/task_commons.dart
1
// Diligence - A Task Management App
2
//
3
// Copyright (C) 2024 Wayne Duran <asartalo@gmail.com>
4
//
5
// This program is free software: you can redistribute it and/or modify it under
6
// the terms of the GNU General Public License as published by the Free Software
7
// Foundation, either version 3 of the License, or (at your option) any later
8
// version.
9
//
10
// This program is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License along with
15
// this program. If not, see <https://www.gnu.org/licenses/>.
16

17
import 'task.dart';
18

19
mixin TaskCommons implements Task {
20
  String? normalizedDetails(String? str) {
10✔
21
    if (str is String && str.trim().isEmpty) {
16✔
22
      return null;
23
    }
24

25
    return str ?? details;
9✔
26
  }
27

28
  DateTime? normalizedDoneAt(DateTime now, bool? doneIntent, DateTime? dt) {
10✔
29
    if (doneIntent == null) {
30
      if (dt == null) {
31
        return doneAt;
9✔
32
      }
33
      if (dt != doneAt) {
2✔
34
        return dt;
35
      }
36
    }
37

38
    if (doneIntent == done) {
12✔
39
      if (dt is DateTime && dt != doneAt) {
×
40
        return dt;
41
      }
42

43
      return doneAt;
×
44
    }
45

46
    if (doneIntent == true) {
6✔
47
      return now;
48
    }
49

50
    return null;
51
  }
52

53
  @override
4✔
54
  Task markDone(DateTime now) {
55
    return copyWith(done: true, now: now);
4✔
56
  }
57

58
  @override
3✔
59
  Task markNotDone(DateTime now) {
60
    return copyWith(done: false, now: now);
3✔
61
  }
62

63
  @override
2✔
64
  void validate() {
65
    if (name.isEmpty) {
4✔
66
      throw ArgumentError('Task name must not be empty.');
1✔
67
    }
68
  }
69

NEW
70
  @override
×
71
  String toString() {
NEW
72
    return 'Task(id: $id, name: $name, parentId: $parentId, done: $done, doneAt: $doneAt, details: $details, expanded: $expanded, uid: $uid, createdAt: $createdAt, updatedAt: $updatedAt, deadlineAt: $deadlineAt)';
×
73
  }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc