aboutsummaryrefslogtreecommitdiff
path: root/src/queries.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/queries.rs')
-rw-r--r--src/queries.rs32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/queries.rs b/src/queries.rs
index f10c7a1..db098e7 100644
--- a/src/queries.rs
+++ b/src/queries.rs
@@ -10,6 +10,8 @@ pub struct Payments {
pub highlight: Option<i64>,
pub user: Option<i64>,
pub category: Option<i64>,
+ pub start_date: Option<String>,
+ pub end_date: Option<String>,
}
pub fn payments_url(q: Payments) -> String {
@@ -33,12 +35,20 @@ pub fn payments_url(q: Payments) -> String {
};
match q.name {
- Some(str) => params.push(format!("name={}", str)),
+ Some(str) => {
+ if !str.is_empty() {
+ params.push(format!("name={}", str))
+ }
+ }
_ => (),
};
match q.cost {
- Some(n) => params.push(format!("cost={}", n)),
+ Some(str) => {
+ if !str.is_empty() {
+ params.push(format!("cost={}", str))
+ }
+ }
_ => (),
};
@@ -52,6 +62,24 @@ pub fn payments_url(q: Payments) -> String {
_ => (),
};
+ match q.start_date {
+ Some(str) => {
+ if !str.is_empty() {
+ params.push(format!("start_date={}", str))
+ }
+ }
+ _ => (),
+ };
+
+ match q.end_date {
+ Some(str) => {
+ if !str.is_empty() {
+ params.push(format!("end_date={}", str))
+ }
+ }
+ _ => (),
+ };
+
if params.is_empty() {
"".to_string()
} else {