Skip to content

Commit

Permalink
Fix query so that it returns MCU families in the right order
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Jun 19, 2024
1 parent 6cfd5b0 commit e3c4871
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CI-Shield-Tests/mbed-os
16 changes: 12 additions & 4 deletions Test-Result-Evaluator/test_result_evaluator/mbed_test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,23 @@ def get_target_drivers(self, target_name: str) -> Set[TargetDriverInfo]:
def get_mcu_family_targets(self) -> List[str]:
"""
Get all the targets that are MCU family targets and should have
webpages generated for them
webpages generated for them. Ordering goes by vendor first, then alphabetically by name.
"""
mcu_family_targets = []

# Note: in the below query, we use a subquery to find any target in the given MCU family with a non-null mcuVendorName.
# This gets the vendor name for ordering.
# We can't query it directly because family targets usually don't have specific device_names associated with them
# in targets.json5, so they won't have a vendor name set.
cursor = self._database.execute("""
SELECT name
FROM Targets
SELECT
OuterTargets.name AS name,
(SELECT max(InnerTargets.mcuVendorName) FROM Targets AS InnerTargets WHERE InnerTargets.mcuFamilyTarget == OuterTargets.name) AS aggregateVendorName
FROM Targets AS OuterTargets
WHERE isMCUFamily == 1
ORDER BY mcuVendorName ASC, name ASC
ORDER BY
aggregateVendorName ASC,
name ASC
""")

for row in cursor:
Expand Down

0 comments on commit e3c4871

Please sign in to comment.