@@ -205,51 +205,36 @@ def get_hardware_selectors(origin: str) -> list[dict]:
205205 params = {"origin" : origin }
206206
207207 query = """
208- WITH recent_tested_checkouts AS (
208+ WITH hwbuilds AS (
209209 SELECT DISTINCT
210- b.checkout_id
211- FROM tests t
212- INNER JOIN builds b ON b.id = t.build_id
213- WHERE
214- t.origin = %(origin)s
215- AND t.start_time > (NOW() - INTERVAL '30 days')
216- AND t.environment_misc ->> 'platform' IS NOT NULL
210+ builds.id,
211+ builds.checkout_id,
212+ tests.environment_misc ->> 'platform' AS platform
213+ FROM tests
214+ INNER JOIN builds ON builds.id = tests.build_id
215+ WHERE tests.origin = %(origin)s
216+ AND tests.start_time > (NOW() - INTERVAL '5 days')
217+ AND tests.environment_misc ->> 'platform' IS NOT NULL
217218 ),
218- qualified_revisions AS (
219- SELECT DISTINCT ON (
220- c.tree_name,
221- c.git_repository_url,
222- c.git_repository_branch,
223- c.git_commit_hash,
224- c.git_commit_name
225- )
226- c.tree_name,
227- c.git_repository_url,
228- c.git_repository_branch,
229- c.git_commit_hash,
230- c.git_commit_name,
231- c.start_time
232- FROM checkouts c
233- INNER JOIN recent_tested_checkouts rtc ON rtc.checkout_id = c.id
234- ORDER BY
235- c.tree_name,
236- c.git_repository_url,
237- c.git_repository_branch,
238- c.git_commit_hash,
239- c.git_commit_name,
240- c.start_time DESC
219+ hwtrees AS (
220+ SELECT
221+ hwbuilds.platform,
222+ checkouts.git_repository_url,
223+ checkouts.tree_name
224+ FROM checkouts
225+ INNER JOIN hwbuilds ON hwbuilds.checkout_id = checkouts.id
241226 )
242- SELECT
243- qr.tree_name ,
244- qr.git_repository_url ,
245- qr .git_repository_branch,
246- qr .git_commit_hash,
247- qr .git_commit_name,
248- qr .start_time
249- FROM qualified_revisions qr
250- ORDER BY
251- qr .tree_name ASC,
252- qr.start_time DESC;
227+ SELECT DISTINCT
228+ checkouts.git_repository_url ,
229+ checkouts.tree_name ,
230+ checkouts .git_repository_branch,
231+ checkouts .git_commit_hash,
232+ checkouts .git_commit_name,
233+ checkouts .start_time
234+ FROM checkouts
235+ INNER JOIN hwtrees
236+ ON hwtrees .tree_name = checkouts.tree_name
237+ AND hwtrees.git_repository_url = checkouts.git_repository_url
253238 """
254239
255240 with connection .cursor () as cursor :
0 commit comments