Add "hide empty Specifications" to Bonsai IFCTester (#7190)

* add filter

* apply filter property

* allow name filter

* black .

* add hide-skipped to html

* rename prop

* only hide optional specifications
This commit is contained in:
Christoph Mellüh
2025-10-06 06:49:35 +02:00
committed by GitHub
parent 16fd614886
commit 8e045d772c
5 changed files with 46 additions and 7 deletions
+5 -3
View File
@@ -55,6 +55,7 @@ class Results(TypedDict):
date: str
filepath: str
filename: str
hide_skipped: bool
specifications: list[ResultsSpecification]
status: bool
total_specifications: int
@@ -236,9 +237,10 @@ class Txt(Console):
class Json(Reporter):
def __init__(self, ids: Ids):
def __init__(self, ids: Ids,hide_skipped = False):
super().__init__(ids)
self.results = Results()
self.results["hide_skipped"] = hide_skipped
def report(self) -> Results:
self.results["title"] = self.ids.info.get("title", "Untitled IDS")
@@ -435,14 +437,14 @@ class Json(Reporter):
class Html(Json):
def __init__(self, ids: Ids):
def __init__(self, ids: Ids, hide_skipped: bool = False):
self.entity_limit = 100
super().__init__(ids)
self.results["hide_skipped"] = hide_skipped
def report(self) -> None:
super().report()
for spec in self.results["specifications"]:
print("checking", spec["cardinality"])
if spec["cardinality"] == "optional" and spec["total_checks"] == 0:
spec["is_skipped"] = True
spec["is_prohibited"] = spec["cardinality"] == "prohibited"
@@ -34,6 +34,9 @@
}
body { font-family: 'Arial', sans-serif; padding: 10px 40px; }
section { padding: 15px; border-radius: 5px; border: 1px solid #eee; margin-bottom: 15px; }
{{#hide_skipped}}
.specification.is-skipped { display: none; }
{{/hide_skipped}}
section>h2 { margin-top: 0px; }
span.time { color: #999; font-style: italic; float: right; }
span.step-time { float: right; color: #555; font-size: 0.8em; font-style: italic; }
@@ -96,7 +99,7 @@
</p>
<hr>
{{#specifications}}
<section style="clear: both; overflow: hidden;">
<section class="specification{{#is_skipped}} is-skipped{{/is_skipped}}" style="clear: both; overflow: hidden;">
<div class="info">
<h2>{{name}}</h2>
{{#description}}