code cleanup; listed invariants; enforce duration minutes invariant across edits; renamed notes to tasks everywhere

This commit is contained in:
aaron-jack-manning
2022-08-30 19:47:23 +10:00
parent 001cc3fa3d
commit f3e6e75a8a
14 changed files with 643 additions and 613 deletions

View File

@@ -1,6 +1,6 @@
use crate::error;
use crate::tasks;
use crate::colour;
use crate::format;
use crate::tasks::Id;
use std::fmt::Write;
@@ -40,7 +40,7 @@ impl Graph {
Err(error::Error::Internal(String::from("Attempt to insert an edge in the dependency graph with a node which wasn't present")))
}
else if first == second {
Err(error::Error::Generic(format!("Note with ID {} cannot depend on itself", colour::text::id(first))))
Err(error::Error::Generic(format!("Note with ID {} cannot depend on itself", format::id(first))))
}
else {
let outgoing = self.edges.get_mut(&first).unwrap();
@@ -136,7 +136,7 @@ pub fn format_cycle(cycle : &Vec<Id>) -> String {
let mut formatted = String::new();
for (index, node) in cycle.iter().enumerate() {
write!(&mut formatted, "{}", colour::text::id(*node)).unwrap();
write!(&mut formatted, "{}", format::id(*node)).unwrap();
if index != cycle.len() - 1 {
formatted.push_str(" -> ");