Output untruncated charts.
This commit is contained in:
parent
d669bef623
commit
0c42818d2f
|
@ -28,8 +28,13 @@ impl UserCountChart {
|
||||||
parent: &PathBuf,
|
parent: &PathBuf,
|
||||||
group_name: &str,
|
group_name: &str,
|
||||||
render_point_circles: bool,
|
render_point_circles: bool,
|
||||||
|
truncate: bool,
|
||||||
) -> Result<PathBuf> {
|
) -> Result<PathBuf> {
|
||||||
let parent = parent.join("charts/user-count");
|
let parent = if truncate {
|
||||||
|
parent.join("charts/user-count")
|
||||||
|
} else {
|
||||||
|
parent.join("charts-untruncated/user-count")
|
||||||
|
};
|
||||||
create_dir_all(&parent).await?;
|
create_dir_all(&parent).await?;
|
||||||
|
|
||||||
let (mut datapoints, mut min_count, mut max_count) = (vec![], i64::MAX, 0);
|
let (mut datapoints, mut min_count, mut max_count) = (vec![], i64::MAX, 0);
|
||||||
|
@ -47,7 +52,7 @@ impl UserCountChart {
|
||||||
}
|
}
|
||||||
|
|
||||||
let datapoints_len = datapoints.len() as isize;
|
let datapoints_len = datapoints.len() as isize;
|
||||||
let min_count = min_count - 10;
|
let min_count = if truncate { min_count - 10 } else { 0 };
|
||||||
let max_count = max_count + 10;
|
let max_count = max_count + 10;
|
||||||
|
|
||||||
let path = parent.join(format!("{group_name}.svg"));
|
let path = parent.join(format!("{group_name}.svg"));
|
||||||
|
|
|
@ -111,12 +111,13 @@ pub async fn run() -> Result<()> {
|
||||||
create_dir_all(&output).await?;
|
create_dir_all(&output).await?;
|
||||||
|
|
||||||
for group in &groups {
|
for group in &groups {
|
||||||
UserCountChart {
|
let chart = UserCountChart {
|
||||||
groups: GroupDataModel::get_n_most_recent(&db, 31, &group.name)
|
groups: GroupDataModel::get_n_most_recent(&db, 31, &group.name)
|
||||||
.await?,
|
.await?,
|
||||||
}
|
};
|
||||||
.render(&output, &group.name, true)
|
|
||||||
.await?;
|
chart.render(&output, &group.name, true, true).await?;
|
||||||
|
chart.render(&output, &group.name, true, false).await?;
|
||||||
|
|
||||||
GroupTemplate::new(group.description.clone(), &group.name)
|
GroupTemplate::new(group.description.clone(), &group.name)
|
||||||
.await
|
.await
|
||||||
|
@ -138,6 +139,13 @@ pub async fn run() -> Result<()> {
|
||||||
let path =
|
let path =
|
||||||
output.join(&format!("charts/user-count/{}.svg", &group.name));
|
output.join(&format!("charts/user-count/{}.svg", &group.name));
|
||||||
copy(path, output.join("charts/main-user-count.svg")).await?;
|
copy(path, output.join("charts/main-user-count.svg")).await?;
|
||||||
|
|
||||||
|
let path = output.join(&format!(
|
||||||
|
"charts-untruncated/user-count/{}.svg",
|
||||||
|
&group.name
|
||||||
|
));
|
||||||
|
copy(path, output.join("charts-untruncated/main-user-count.svg"))
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue