Fix habitask
This commit is contained in:
parent
8d82ba5670
commit
11f62453c8
4 changed files with 6 additions and 19 deletions
|
@ -22,6 +22,7 @@ imports = [
|
||||||
./modules/unlock.nix
|
./modules/unlock.nix
|
||||||
./modules/weechat
|
./modules/weechat
|
||||||
./modules/update_tasks.nix
|
./modules/update_tasks.nix
|
||||||
|
./modules/habitask.nix
|
||||||
../common
|
../common
|
||||||
# ./sort-mail.nix
|
# ./sort-mail.nix
|
||||||
# ./morgenreport.nix
|
# ./morgenreport.nix
|
||||||
|
|
|
@ -16,7 +16,7 @@ config = mkIf config.m-0.habitask.enable {
|
||||||
ExecStart="${pkgs.habitask}/bin/habitask";
|
ExecStart="${pkgs.habitask}/bin/habitask";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
timers.update_tasks = {
|
timers.habitask = {
|
||||||
Timer = {
|
Timer = {
|
||||||
OnCalendar = "19:56:00";
|
OnCalendar = "19:56:00";
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct Response {
|
||||||
impl Habitask {
|
impl Habitask {
|
||||||
fn new() -> Habitask {
|
fn new() -> Habitask {
|
||||||
let mut s = Config::new();
|
let mut s = Config::new();
|
||||||
s.merge(Environment::with_prefix("habatisk"));
|
s.merge(Environment::with_prefix("habitask"));
|
||||||
let s: Settings = s.try_into().unwrap();
|
let s: Settings = s.try_into().unwrap();
|
||||||
Habitask {
|
Habitask {
|
||||||
client: Client::new(),
|
client: Client::new(),
|
||||||
|
@ -112,7 +112,6 @@ impl Habitask {
|
||||||
.json(&map)
|
.json(&map)
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{:?}", res);
|
|
||||||
let Response { data } = res.json().unwrap();
|
let Response { data } = res.json().unwrap();
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
@ -125,7 +124,6 @@ impl Habitask {
|
||||||
).json(&map)
|
).json(&map)
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{:?}", res);
|
|
||||||
let Response { data } = res.json().unwrap();
|
let Response { data } = res.json().unwrap();
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
@ -138,7 +136,6 @@ impl Habitask {
|
||||||
).json(&map)
|
).json(&map)
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{:?}", res);
|
|
||||||
}
|
}
|
||||||
fn score_task(&self, id: &str) {
|
fn score_task(&self, id: &str) {
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
|
@ -148,7 +145,6 @@ impl Habitask {
|
||||||
).json(&map)
|
).json(&map)
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{:?}", res);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +152,8 @@ fn main() {
|
||||||
let habitask = Habitask::new();
|
let habitask = Habitask::new();
|
||||||
let new = "-DELETED entry.after:now-24h";
|
let new = "-DELETED entry.after:now-24h";
|
||||||
let done = "+COMPLETED end.after:now-24h";
|
let done = "+COMPLETED end.after:now-24h";
|
||||||
let after = "entry.after:new-";
|
let after = "entry.after:now-";
|
||||||
let before = "entry.before:new-";
|
let before = "entry.before:now-";
|
||||||
let mask = "-auto";
|
let mask = "-auto";
|
||||||
let habitask = Habitask::new();
|
let habitask = Habitask::new();
|
||||||
let instant_done = query(format!("{} -TAGGED {}48h {}", done, after, mask));
|
let instant_done = query(format!("{} -TAGGED {}48h {}", done, after, mask));
|
||||||
|
@ -174,17 +170,6 @@ fn main() {
|
||||||
));
|
));
|
||||||
let very_old = query(format!("{} {}1year {}3month {}", done, after, before, mask));
|
let very_old = query(format!("{} {}1year {}3month {}", done, after, before, mask));
|
||||||
let crazy_old = query(format!("{} {}1year {}", done, before, mask));
|
let crazy_old = query(format!("{} {}1year {}", done, before, mask));
|
||||||
println!(
|
|
||||||
"{},{},{},{},{},{},{},{}",
|
|
||||||
tasks.len(),
|
|
||||||
routines.len(),
|
|
||||||
instant_done.len(),
|
|
||||||
created.len(),
|
|
||||||
a_little_old.len(),
|
|
||||||
old.len(),
|
|
||||||
very_old.len(),
|
|
||||||
crazy_old.len()
|
|
||||||
);
|
|
||||||
for _ in created {
|
for _ in created {
|
||||||
habitask.score_task("note");
|
habitask.score_task("note");
|
||||||
blink();
|
blink();
|
||||||
|
|
|
@ -9,6 +9,7 @@ imports = [
|
||||||
m-0 = {
|
m-0 = {
|
||||||
hostName = "hera";
|
hostName = "hera";
|
||||||
taskwarrior.enable = true;
|
taskwarrior.enable = true;
|
||||||
|
habitask.enable = true;
|
||||||
weechat = {
|
weechat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = config.m-0.private.hackint.user;
|
user = config.m-0.private.hackint.user;
|
||||||
|
|
Loading…
Reference in a new issue