Gate sub-components section on eligible devices via can_have_subcomponents()

This commit is contained in:
2026-06-12 08:32:53 -05:00
parent ff1a883170
commit c0115aebf9
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -76,6 +76,9 @@ class Device(Base):
def is_subcomponent(self): def is_subcomponent(self):
return self.parent_id is not None return self.parent_id is not None
def can_have_subcomponents(self):
return self.parent_id is None and self.battery_slots == 0
def effective_installed_count(self): def effective_installed_count(self):
if self.has_children(): if self.has_children():
return sum(c.installed_count() for c in self.children) return sum(c.installed_count() for c in self.children)
+1 -1
View File
@@ -108,7 +108,7 @@
</table> </table>
</div> </div>
{% if device.children or not device.is_subcomponent() %} {% if device.children or device.can_have_subcomponents() %}
<div class="card"> <div class="card">
{% if device.children %} {% if device.children %}
<h2>Sub-components</h2> <h2>Sub-components</h2>