digest: use created_at instead of timestamp for date matching
Episodic entries should be grouped by creation date, not last update date. Fixes digest generation potentially assigning updated entries to the wrong day. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
eac59b423e
commit
8eaf4c5956
1 changed files with 4 additions and 4 deletions
|
|
@ -156,8 +156,8 @@ fn gather(level: &DigestLevel, store: &Store, arg: &str) -> Result<GatherResult,
|
|||
// Leaf level: scan store for episodic entries matching date
|
||||
let mut entries: Vec<_> = store.nodes.iter()
|
||||
.filter(|(_, n)| n.node_type == store::NodeType::EpisodicSession
|
||||
&& n.timestamp > 0
|
||||
&& store::format_date(n.timestamp) == label)
|
||||
&& n.created_at > 0
|
||||
&& store::format_date(n.created_at) == label)
|
||||
.map(|(key, n)| {
|
||||
(store::format_datetime(n.timestamp), n.content.clone(), key.clone())
|
||||
})
|
||||
|
|
@ -298,8 +298,8 @@ pub fn digest_auto(store: &mut Store) -> Result<(), String> {
|
|||
|
||||
// Collect all dates with episodic entries
|
||||
let dates: Vec<String> = store.nodes.values()
|
||||
.filter(|n| n.node_type == store::NodeType::EpisodicSession && n.timestamp > 0)
|
||||
.map(|n| store::format_date(n.timestamp))
|
||||
.filter(|n| n.node_type == store::NodeType::EpisodicSession && n.created_at > 0)
|
||||
.map(|n| store::format_date(n.created_at))
|
||||
.collect::<BTreeSet<_>>()
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue