summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web_frontend/chart.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/web_frontend/chart.rs b/src/web_frontend/chart.rs
index 43ec3eb..0992e99 100644
--- a/src/web_frontend/chart.rs
+++ b/src/web_frontend/chart.rs
@@ -13,9 +13,15 @@ use chrono::{NaiveDate, Utc};
use chrono::Datelike;
#[derive(Serialize)]
+struct GroupValues {
+ amount : f32,
+ filter : String
+}
+
+#[derive(Serialize)]
struct ChartContext {
account_name : String,
- groups : HashMap<String, f32>,
+ groups : HashMap<String, GroupValues>,
total_sum : f32,
total_chart : f32,
date_start : String,
@@ -71,9 +77,14 @@ pub fn chart_handler(account : &RawStr, start : Option<&RawStr>, end : Option<&R
println!("total sum: {}", total_sum);
let mut total_chart = 0.0;
for (section_name, entries) in ini_file.sections {
+ let mut filter_string = String::from("");
let mut complete = 0.0;
for (key, values) in entries {
for val in values {
+ filter_string.push_str(&key);
+ filter_string.push_str("-");
+ filter_string.push_str(&val);
+ filter_string.push_str(".");
let mut t_filtered_cloned = t_filtered.clone();
if val.is_empty() || val.is_empty() {
continue
@@ -85,7 +96,7 @@ pub fn chart_handler(account : &RawStr, start : Option<&RawStr>, end : Option<&R
complete = complete + tmp.abs();
}
}
- groups.insert(section_name, complete);
+ groups.insert(section_name, GroupValues{ amount: complete, filter : filter_string } );
total_chart = total_chart + complete;
// ALSO INSERT OTHER, AKA THE REST
}