diff --git a/src/configuration.rs b/src/configuration.rs index e3d2ba8..777c7e6 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -22,7 +22,7 @@ pub static DEFAULT_NESTED_TAG: &str = "/"; pub static DEFAULT_ANNOTATION_TEMPLATE: &str = r#" ### {{id}} -Group: {{group_id}} ({{group_name}}) +Group: {{group}} ({{group_name}}) Created: {{date_format "%c" created}} Tags: {{#each tags}}{{this}}{{#unless @last}}, {{/unless}}{{/each}} @@ -53,8 +53,8 @@ pub enum OrderBy { Empty, Created, Updated, - GroupID, Group, + GroupName, } impl fmt::Display for OrderBy { @@ -68,8 +68,8 @@ impl fmt::Display for OrderBy { OrderBy::Empty => write!(f, "empty"), OrderBy::Created => write!(f, "created"), OrderBy::Updated => write!(f, "updated"), - OrderBy::GroupID => write!(f, "group_id"), OrderBy::Group => write!(f, "group"), + OrderBy::GroupName => write!(f, "group_name"), } } } @@ -418,8 +418,8 @@ file_extension = '{}' OrderBy::BaseURI, OrderBy::Title, OrderBy::ID, - OrderBy::GroupID, OrderBy::Group, + OrderBy::GroupName, ]; let order = Self::get_order_bys(selections)?; if order.is_empty() { @@ -461,8 +461,8 @@ file_extension = '{}' OrderBy::Title, OrderBy::Created, OrderBy::Updated, - OrderBy::GroupID, OrderBy::Group, + OrderBy::GroupName, ]; let order = Self::get_order_bys(selections)?; diff --git a/src/gooseberry/knowledge_base.rs b/src/gooseberry/knowledge_base.rs index 7d93891..26d100b 100644 --- a/src/gooseberry/knowledge_base.rs +++ b/src/gooseberry/knowledge_base.rs @@ -36,7 +36,6 @@ pub struct AnnotationTemplate { pub highlight: Vec, pub display_name: Option, pub group_name: String, - pub group_id: String, } pub fn replace_spaces(astring: &str) -> String { @@ -77,7 +76,6 @@ impl AnnotationTemplate { .get(&annotation.group) .unwrap_or(&annotation.group) .to_owned(); - let group_id = annotation.group.to_owned(); AnnotationTemplate { annotation, base_uri, @@ -86,7 +84,6 @@ impl AnnotationTemplate { highlight, display_name, group_name, - group_id, } } } @@ -231,15 +228,15 @@ fn group_annotations_by_order( .push(annotation); } } - OrderBy::GroupID => { + OrderBy::Group => { for annotation in annotations { order_to_annotations - .entry(annotation.group_id.to_string()) + .entry(annotation.annotation.group.to_string()) .or_insert_with(Vec::new) .push(annotation); } } - OrderBy::Group => { + OrderBy::GroupName => { for annotation in annotations { order_to_annotations .entry(annotation.group_name.to_string()) @@ -270,8 +267,8 @@ fn sort_annotations(sort: &[OrderBy], annotations: &mut [AnnotationTemplate]) { .cmp(&format!("{}", b.annotation.created.format("%+"))), OrderBy::Updated => format!("{}", a.annotation.updated.format("%+")) .cmp(&format!("{}", b.annotation.updated.format("%+"))), - OrderBy::GroupID => a.group_id.cmp(&b.group_id), - OrderBy::Group => a.group_name.cmp(&b.group_name), + OrderBy::Group => a.annotation.group.cmp(&b.annotation.group), + OrderBy::GroupName => a.group_name.cmp(&b.group_name), OrderBy::Empty => panic!("Shouldn't happen"), }) })