Compare commits
No commits in common. "7fb951ff7b8c8bb11b30e01aa6564d7810aa12f5" and "65eb941eb45c515b7fc3732013c7d017b6591f14" have entirely different histories.
7fb951ff7b
...
65eb941eb4
|
@ -80,7 +80,7 @@ impl UserCountChart {
|
||||||
.configure_mesh()
|
.configure_mesh()
|
||||||
.x_labels(datapoints.len() + 2)
|
.x_labels(datapoints.len() + 2)
|
||||||
.x_label_formatter(&|x| {
|
.x_label_formatter(&|x| {
|
||||||
if (x - 1) % (datapoints_len / 20).max(1) != 0 {
|
if (x - 1) % (datapoints_len / 20) != 0 {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
format!("{:0}", datapoints_len - x)
|
format!("{:0}", datapoints_len - x)
|
||||||
|
@ -122,7 +122,7 @@ impl UserCountChart {
|
||||||
)
|
)
|
||||||
+ Text::new(
|
+ Text::new(
|
||||||
{
|
{
|
||||||
if (x - 1) % (datapoints_len / 10).max(1) != 0 {
|
if (x - 1) % (datapoints_len / 10) != 0 {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
format!("{:0}", y)
|
format!("{:0}", y)
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub async fn run() -> Result<()> {
|
||||||
if let Some(snapshot) = SnapshotModel::get_most_recent(&db).await? {
|
if let Some(snapshot) = SnapshotModel::get_most_recent(&db).await? {
|
||||||
(
|
(
|
||||||
GroupDataModel::get_all_by_snapshot(&db, &snapshot).await?,
|
GroupDataModel::get_all_by_snapshot(&db, &snapshot).await?,
|
||||||
GroupDataModel::get_tildes_official_data(&db, &snapshot).await?,
|
GroupDataModel::get_highest_subscribers(&db, &snapshot).await?,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(vec![], None)
|
(vec![], None)
|
||||||
|
|
|
@ -28,15 +28,14 @@ impl GroupDataModel {
|
||||||
Ok(groups)
|
Ok(groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the group data for ~tildes.official.
|
/// Get the group with the highest subscriber count from a given snapshot.
|
||||||
pub async fn get_tildes_official_data(
|
pub async fn get_highest_subscribers(
|
||||||
db: &DatabaseConnection,
|
db: &DatabaseConnection,
|
||||||
snapshot: &SnapshotModel,
|
snapshot: &SnapshotModel,
|
||||||
) -> Result<Option<Self>> {
|
) -> Result<Option<Self>> {
|
||||||
let group = snapshot
|
let group = snapshot
|
||||||
.find_related(GroupDataEntity)
|
.find_related(GroupDataEntity)
|
||||||
.order_by_desc(GroupDataColumn::Subscribers)
|
.order_by_desc(GroupDataColumn::Subscribers)
|
||||||
.filter(GroupDataColumn::Name.eq("~tildes.official"))
|
|
||||||
.one(db)
|
.one(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ group.subscribers }} <span class="small"
|
{{ group.subscribers }} <span class="small"
|
||||||
title="Percentage of subscribers compared to ~tildes.official."
|
title="Percentage of subscribers compared to the highest-subscribed group."
|
||||||
>({{ group.subscribers|percentage(user_count) }})</span>
|
>({{ group.subscribers|percentage(user_count) }})</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Reference in New Issue