hours_since_last_dream: return 0 if dream in progress
The function was reading from dream-log.jsonl which only updates when dreams complete. If a dream session was started but not yet ended, it would show stale hours. Now checks for active dream state first. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
81e0632cf3
commit
b649a11645
1 changed files with 4 additions and 0 deletions
|
|
@ -372,6 +372,10 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hours_since_last_dream() -> u64 {
|
pub fn hours_since_last_dream() -> u64 {
|
||||||
|
// If a dream is currently in progress, no nudge needed
|
||||||
|
if home().join(".consciousness/state/dream-state").exists() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
let path = home().join(".consciousness/logs/dream-log.jsonl");
|
let path = home().join(".consciousness/logs/dream-log.jsonl");
|
||||||
let content = match fs::read_to_string(path) {
|
let content = match fs::read_to_string(path) {
|
||||||
Ok(c) if !c.is_empty() => c,
|
Ok(c) if !c.is_empty() => c,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue