From c50e10aa21798f1c85bf7718109d3939c119b854 Mon Sep 17 00:00:00 2001 From: jiftechnify Date: Sat, 15 Jul 2023 10:57:31 +0900 Subject: [PATCH] fix: keep up with the latest specs for since/until filter --- src/repo/postgres.rs | 4 ++-- src/repo/sqlite.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/repo/postgres.rs b/src/repo/postgres.rs index 8fc46eb..cc899e8 100644 --- a/src/repo/postgres.rs +++ b/src/repo/postgres.rs @@ -904,7 +904,7 @@ fn query_from_filter(f: &ReqFilter) -> Option> { } push_and = true; query - .push("e.created_at > ") + .push("e.created_at >= ") .push_bind(Utc.timestamp_opt(f.since.unwrap() as i64, 0).unwrap()); } @@ -915,7 +915,7 @@ fn query_from_filter(f: &ReqFilter) -> Option> { } push_and = true; query - .push("e.created_at < ") + .push("e.created_at <= ") .push_bind(Utc.timestamp_opt(f.until.unwrap() as i64, 0).unwrap()); } diff --git a/src/repo/sqlite.rs b/src/repo/sqlite.rs index 87d8556..8f5b798 100644 --- a/src/repo/sqlite.rs +++ b/src/repo/sqlite.rs @@ -1083,13 +1083,13 @@ fn query_from_filter(f: &ReqFilter) -> (String, Vec>, Option {}", f.since.unwrap()); + since_clause = format!("AND created_at >= {}", f.since.unwrap()); } else { since_clause = String::new(); }; // Query for timestamp if f.until.is_some() { - until_clause = format!("AND created_at < {}", f.until.unwrap()); + until_clause = format!("AND created_at <= {}", f.until.unwrap()); } else { until_clause = String::new(); }; @@ -1107,12 +1107,12 @@ fn query_from_filter(f: &ReqFilter) -> (String, Vec>, Option {}", f.since.unwrap()); + let created_clause = format!("created_at >= {}", f.since.unwrap()); filter_components.push(created_clause); } // Query for timestamp if f.until.is_some() { - let until_clause = format!("created_at < {}", f.until.unwrap()); + let until_clause = format!("created_at <= {}", f.until.unwrap()); filter_components.push(until_clause); } // never display hidden events