aboutsummaryrefslogtreecommitdiff
path: root/karld/src/demo.rs
diff options
context:
space:
mode:
authormetamuffin <yvchraiqi@protonmail.com>2022-08-17 17:49:31 +0200
committermetamuffin <yvchraiqi@protonmail.com>2022-08-17 17:49:31 +0200
commitc0f90386900f0f767c7d0569e0f758d305af3d09 (patch)
treedc576c31200c1059d658915688cca1fd03ef9424 /karld/src/demo.rs
parentc10e88e42b26637e3c48ed781ced1382fb20fa26 (diff)
downloadkarlender-c0f90386900f0f767c7d0569e0f758d305af3d09.tar
karlender-c0f90386900f0f767c7d0569e0f758d305af3d09.tar.bz2
karlender-c0f90386900f0f767c7d0569e0f758d305af3d09.tar.zst
Revert "Revert "modularize interfaces""
This reverts commit c10e88e42b26637e3c48ed781ced1382fb20fa26.
Diffstat (limited to 'karld/src/demo.rs')
-rw-r--r--karld/src/demo.rs93
1 files changed, 93 insertions, 0 deletions
diff --git a/karld/src/demo.rs b/karld/src/demo.rs
new file mode 100644
index 0000000..fb5b43a
--- /dev/null
+++ b/karld/src/demo.rs
@@ -0,0 +1,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,
+ },
+ },
+ );
+}