1
0
Fork 0

Fix habitask

This commit is contained in:
Malte Brandy 2018-07-28 00:29:56 +02:00
parent 8d82ba5670
commit 11f62453c8
4 changed files with 6 additions and 19 deletions

View file

@ -22,6 +22,7 @@ imports = [
./modules/unlock.nix
./modules/weechat
./modules/update_tasks.nix
./modules/habitask.nix
../common
# ./sort-mail.nix
# ./morgenreport.nix

View file

@ -16,7 +16,7 @@ config = mkIf config.m-0.habitask.enable {
ExecStart="${pkgs.habitask}/bin/habitask";
};
};
timers.update_tasks = {
timers.habitask = {
Timer = {
OnCalendar = "19:56:00";
};

View file

@ -66,7 +66,7 @@ struct Response {
impl Habitask {
fn new() -> Habitask {
let mut s = Config::new();
s.merge(Environment::with_prefix("habatisk"));
s.merge(Environment::with_prefix("habitask"));
let s: Settings = s.try_into().unwrap();
Habitask {
client: Client::new(),
@ -112,7 +112,6 @@ impl Habitask {
.json(&map)
.send()
.unwrap();
println!("{:?}", res);
let Response { data } = res.json().unwrap();
data
}
@ -125,7 +124,6 @@ impl Habitask {
).json(&map)
.send()
.unwrap();
println!("{:?}", res);
let Response { data } = res.json().unwrap();
data
}
@ -138,7 +136,6 @@ impl Habitask {
).json(&map)
.send()
.unwrap();
println!("{:?}", res);
}
fn score_task(&self, id: &str) {
let client = Client::new();
@ -148,7 +145,6 @@ impl Habitask {
).json(&map)
.send()
.unwrap();
println!("{:?}", res);
}
}
@ -156,8 +152,8 @@ fn main() {
let habitask = Habitask::new();
let new = "-DELETED entry.after:now-24h";
let done = "+COMPLETED end.after:now-24h";
let after = "entry.after:new-";
let before = "entry.before:new-";
let after = "entry.after:now-";
let before = "entry.before:now-";
let mask = "-auto";
let habitask = Habitask::new();
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 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 {
habitask.score_task("note");
blink();

View file

@ -9,6 +9,7 @@ imports = [
m-0 = {
hostName = "hera";
taskwarrior.enable = true;
habitask.enable = true;
weechat = {
enable = true;
user = config.m-0.private.hackint.user;