Skip to content

Commit d6eb33c

Browse files
committed
Critical fixes due to a corporate PR policy violation
1 parent 29808d0 commit d6eb33c

File tree

1 file changed

+5
-5
lines changed
  • moooodotfarm-backend/src/ports/http

1 file changed

+5
-5
lines changed

moooodotfarm-backend/src/ports/http/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,18 @@ lazy_static::lazy_static! {
253253
static ref RECENTLY_SEEN_THRESHOLD: crate::domain::time::Duration =
254254
crate::domain::time::Duration::new_from_hours(2);
255255

256-
static ref NEW_COW_THRESHOLD: crate::domain::time::Duration =
256+
static ref NEW_THRESHOLD: crate::domain::time::Duration =
257257
crate::domain::time::Duration::new_from_days(14);
258258
}
259259

260260
impl From<&app::Cow> for TemplateCow {
261261
fn from(value: &app::Cow) -> Self {
262+
let now = DateTime::now();
263+
262264
let last_seen_str = value
263265
.last_seen()
264266
.map(|v| {
265-
let now = DateTime::now();
266-
let duration = &now - v;
267-
if duration < *RECENTLY_SEEN_THRESHOLD {
267+
if &now - v < *RECENTLY_SEEN_THRESHOLD {
268268
"very recently".to_string()
269269
} else {
270270
v.ago()
@@ -273,7 +273,7 @@ impl From<&app::Cow> for TemplateCow {
273273
.unwrap_or_else(|| "never".to_string());
274274
let is_new = value
275275
.first_seen()
276-
.map(|v| DateTime::now() - v < *NEW_COW_THRESHOLD)
276+
.map(|v| &now - v < *NEW_THRESHOLD)
277277
.unwrap_or(false);
278278

279279
Self {

0 commit comments

Comments
 (0)