1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
use karlcommon::{Task, Schedule, Condition, Property};
use crate::TASKS;
pub fn load_demo() {
TASKS.write().unwrap().insert(
0,
Task {
id: 0,
name: "Mittagessen im Februar".to_string(),
description: None,
tags: vec!["Essen".to_string(), "Unwichtig".to_string()],
schedule: Schedule::Condition(Condition::And(vec![
Condition::Equal {
modulus: None,
prop: Property::Monthofyear,
value: 1,
},
Condition::Equal {
modulus: None,
prop: Property::Hour,
value: 12,
},
])),
},
);
TASKS.write().unwrap().insert(
1,
Task {
id: 1,
name: "Abendessen oder Frühstück".to_string(),
description: Some("Nom nom nom".to_string()),
tags: vec!["Essen".to_string()],
schedule: Schedule::Condition(Condition::Or(vec![
Condition::Equal {
modulus: None,
prop: Property::Hour,
value: 18,
},
Condition::Equal {
modulus: None,
prop: Property::Hour,
value: 7,
},
])),
},
);
TASKS.write().unwrap().insert(
2,
Task {
id: 2,
description: None,
name: "Wichtiger termin™".to_string(),
tags: vec![],
schedule: Schedule::Static(1654997366..1655007366),
},
);
TASKS.write().unwrap().insert(
3,
Task {
id: 3,
description: None,
name: "Staubsaugen".to_string(),
tags: vec!["Unwichtig".to_string()],
schedule: Schedule::Dynamic {
scheduled: None,
duration: 15 * 60,
priority: 2.0,
condition: Condition::Equal {
prop: Property::Monthofyear,
value: 6,
modulus: None,
},
},
},
);
TASKS.write().unwrap().insert(
4,
Task {
id: 4,
description: Some("sollte ich wirklich mal machen".to_string()),
name: "Geschirrspüler ausräumen".to_string(),
tags: vec!["Unwichtig".to_string()],
schedule: Schedule::Dynamic {
scheduled: None,
duration: 15 * 60,
priority: 5.0,
condition: Condition::Never,
},
},
);
}
|