Fix platform counts with hidden projects

This commit is contained in:
Luke Street
2025-11-26 23:40:41 -07:00
parent 0f8bed27b3
commit e6a58d2818
2 changed files with 22 additions and 20 deletions
+20 -18
View File
@@ -170,24 +170,7 @@ pub async fn get_projects(
.collect::<Vec<_>>();
let show_all = platforms.is_empty() || platforms == ALL_PLATFORMS;
let mut projects = state.db.get_projects().await?;
let available_platforms = projects
.iter()
.filter_map(|p| p.project.platform.as_deref())
.filter_map(|s| Platform::from_str(s).ok())
.sorted()
.dedup_with_count()
.collect::<Vec<_>>();
if !show_all {
projects.retain(|p| {
p.project
.platform
.as_deref()
.and_then(|p| Platform::from_str(p).ok())
.is_some_and(|p| platforms.contains(&p))
});
}
let projects = state.db.get_projects().await?;
let mut out = projects
.iter()
@@ -250,6 +233,25 @@ pub async fn get_projects(
project_visibility(&c.info.project, Some(&c.measures)) == ProjectVisibility::Visible
});
let available_platforms = out
.iter()
.filter_map(|p| p.info.project.platform.as_deref())
.filter_map(|s| Platform::from_str(s).ok())
.sorted()
.dedup_with_count()
.collect::<Vec<_>>();
if !show_all {
out.retain(|c| {
c.info
.project
.platform
.as_deref()
.and_then(|p| Platform::from_str(p).ok())
.is_some_and(|p| platforms.contains(&p))
});
}
let current_sort_key = query.sort.as_deref().unwrap_or("updated");
let current_sort = SORT_OPTIONS
.iter()
+2 -2
View File
@@ -1034,7 +1034,7 @@ async fn render_report(
}
}
}
@if current_top_category.subcategories.len() > 0 {
@if !current_top_category.subcategories.is_empty() {
details.dropdown {
summary { (current_category_item.name) }
ul {
@@ -1215,7 +1215,7 @@ async fn render_history(
}
}
}
@if current_top_category.subcategories.len() > 0 {
@if !current_top_category.subcategories.is_empty() {
details.dropdown title="Subcategory" {
summary { (current_category_item.name) }
ul {