Compare commits
2 Commits
d669bef623
...
db0f1c5be8
Author | SHA1 | Date |
---|---|---|
Bauke | db0f1c5be8 | |
Bauke | 0c42818d2f |
|
@ -28,8 +28,13 @@ impl UserCountChart {
|
|||
parent: &PathBuf,
|
||||
group_name: &str,
|
||||
render_point_circles: bool,
|
||||
truncate: bool,
|
||||
) -> 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?;
|
||||
|
||||
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 min_count = min_count - 10;
|
||||
let min_count = if truncate { min_count - 10 } else { 0 };
|
||||
let max_count = max_count + 10;
|
||||
|
||||
let path = parent.join(format!("{group_name}.svg"));
|
||||
|
|
|
@ -111,12 +111,13 @@ pub async fn run() -> Result<()> {
|
|||
create_dir_all(&output).await?;
|
||||
|
||||
for group in &groups {
|
||||
UserCountChart {
|
||||
let chart = UserCountChart {
|
||||
groups: GroupDataModel::get_n_most_recent(&db, 31, &group.name)
|
||||
.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)
|
||||
.await
|
||||
|
@ -138,6 +139,13 @@ pub async fn run() -> Result<()> {
|
|||
let path =
|
||||
output.join(&format!("charts/user-count/{}.svg", &group.name));
|
||||
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?;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -19,5 +19,10 @@
|
|||
|
||||
<img class="chart" src="/charts/user-count/{{ group_name }}.svg"
|
||||
alt="{{ group_name }} User Count Chart">
|
||||
|
||||
<p>
|
||||
See also the
|
||||
<a href="/charts-untruncated/user-count/{{ group_name }}.svg">untruncated version</a>.
|
||||
</p>
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
|
||||
<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>
|
||||
<summary>Groups Overview</summary>
|
||||
|
||||
|
|
Loading…
Reference in New Issue