Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions moooodotfarm-backend/src/ports/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,18 @@ lazy_static::lazy_static! {
static ref RECENTLY_SEEN_THRESHOLD: crate::domain::time::Duration =
crate::domain::time::Duration::new_from_hours(2);

static ref NEW_COW_THRESHOLD: crate::domain::time::Duration =
static ref NEW_THRESHOLD: crate::domain::time::Duration =
crate::domain::time::Duration::new_from_days(14);
}

impl From<&app::Cow> for TemplateCow {
fn from(value: &app::Cow) -> Self {
let now = DateTime::now();

let last_seen_str = value
.last_seen()
.map(|v| {
let now = DateTime::now();
let duration = &now - v;
if duration < *RECENTLY_SEEN_THRESHOLD {
if &now - v < *RECENTLY_SEEN_THRESHOLD {
"very recently".to_string()
} else {
v.ago()
Expand All @@ -273,7 +273,7 @@ impl From<&app::Cow> for TemplateCow {
.unwrap_or_else(|| "never".to_string());
let is_new = value
.first_seen()
.map(|v| DateTime::now() - v < *NEW_COW_THRESHOLD)
.map(|v| &now - v < *NEW_THRESHOLD)
.unwrap_or(false);

Self {
Expand Down
Loading