mirror of
https://github.com/encounter/decomp.dev.git
synced 2026-07-10 03:18:48 -07:00
Fix platform counts with hidden projects
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user