Render total charts with all group data available.
This commit is contained in:
parent
d615aa2843
commit
f28a0bf505
|
@ -29,12 +29,9 @@ impl UserCountChart {
|
||||||
group_name: &str,
|
group_name: &str,
|
||||||
render_point_circles: bool,
|
render_point_circles: bool,
|
||||||
truncate: bool,
|
truncate: bool,
|
||||||
|
output_dir: &str,
|
||||||
) -> Result<PathBuf> {
|
) -> Result<PathBuf> {
|
||||||
let parent = if truncate {
|
let parent = parent.join(format!("{}/user-count", output_dir));
|
||||||
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);
|
||||||
|
|
|
@ -115,9 +115,31 @@ pub async fn run() -> Result<()> {
|
||||||
groups: GroupDataModel::get_n_most_recent(&db, 31, &group.name)
|
groups: GroupDataModel::get_n_most_recent(&db, 31, &group.name)
|
||||||
.await?,
|
.await?,
|
||||||
};
|
};
|
||||||
|
chart
|
||||||
|
.render(&output, &group.name, true, true, "charts")
|
||||||
|
.await?;
|
||||||
|
chart
|
||||||
|
.render(&output, &group.name, true, false, "charts-untruncated")
|
||||||
|
.await?;
|
||||||
|
|
||||||
chart.render(&output, &group.name, true, true).await?;
|
{
|
||||||
chart.render(&output, &group.name, true, false).await?;
|
let total_chart = UserCountChart {
|
||||||
|
groups: GroupDataModel::get_all(&db, &group.name).await?,
|
||||||
|
};
|
||||||
|
|
||||||
|
total_chart
|
||||||
|
.render(&output, &group.name, false, true, "charts-total")
|
||||||
|
.await?;
|
||||||
|
total_chart
|
||||||
|
.render(
|
||||||
|
&output,
|
||||||
|
&group.name,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
"charts-total-untruncated",
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
GroupTemplate::new(group.description.clone(), &group.name)
|
GroupTemplate::new(group.description.clone(), &group.name)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -42,6 +42,20 @@ impl GroupDataModel {
|
||||||
Ok(group)
|
Ok(group)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get all the saved group datas from a given group name.
|
||||||
|
pub async fn get_all(
|
||||||
|
db: &DatabaseConnection,
|
||||||
|
name: &str,
|
||||||
|
) -> Result<Vec<Self>> {
|
||||||
|
Ok(
|
||||||
|
GroupDataEntity::find()
|
||||||
|
.order_by_asc(GroupDataColumn::SnapshotId)
|
||||||
|
.filter(GroupDataColumn::Name.eq(name))
|
||||||
|
.all(db)
|
||||||
|
.await?,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the N most recently saved group datas from a given group name.
|
/// Get the N most recently saved group datas from a given group name.
|
||||||
pub async fn get_n_most_recent(
|
pub async fn get_n_most_recent(
|
||||||
db: &DatabaseConnection,
|
db: &DatabaseConnection,
|
||||||
|
|
Loading…
Reference in New Issue