Compare commits

..

2 Commits

Author SHA1 Message Date
Bauke db0f1c5be8
Add a link to the untruncated charts. 2023-06-14 12:51:10 +02:00
Bauke 0c42818d2f
Output untruncated charts. 2023-06-14 12:50:32 +02:00
4 changed files with 29 additions and 6 deletions

View File

@ -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"));

View File

@ -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?;
} }
} }
}, },

View File

@ -19,5 +19,10 @@
<img class="chart" src="/charts/user-count/{{ group_name }}.svg" <img class="chart" src="/charts/user-count/{{ group_name }}.svg"
alt="{{ group_name }} User Count Chart"> alt="{{ group_name }} User Count Chart">
<p>
See also the
<a href="/charts-untruncated/user-count/{{ group_name }}.svg">untruncated version</a>.
</p>
</main> </main>
{% endblock %} {% endblock %}

View File

@ -21,6 +21,11 @@
<img class="chart" src="/charts/main-user-count.svg" alt="User Count Chart"> <img class="chart" src="/charts/main-user-count.svg" alt="User Count Chart">
<p>
See also the
<a href="/charts-untruncated/main-user-count.svg">untruncated version</a>.
</p>
<details open> <details open>
<summary>Groups Overview</summary> <summary>Groups Overview</summary>