Changes between Version 2 and Version 3 of TopPerformingComponents
- Timestamp:
- 01/29/26 03:49:07 (10 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TopPerformingComponents
v2 v3 1 = Complex DB Reports (SQL, Stored Procedures, Relational Algebra) = 2 3 === Top Performing Components in Highly-Rated Builds === 1 == Top Performing Components in Highly-Rated Builds == 4 2 5 3 Report on which specific components appear most frequently in builds that have received a high average user rating (4.5 stars or higher) within the last year. … … 8 6 9 7 {{{ 10 SELECT 8 CREATE OR REPLACE FUNCTION get_report_top_components() 9 RETURNS TABLE ( 10 type TEXT, 11 brand TEXT, 12 name TEXT, 13 usage_count BIGINT, 14 avg_build_rating NUMERIC 15 ) 16 LANGUAGE sql 17 AS $$ 18 SELECT 11 19 c.type, 12 20 c.brand, … … 15 23 AVG(rb.value) AS avg_build_rating 16 24 FROM components c 17 JOIN build_component bc ON c.id = bc.component_id18 JOIN build b ON bc.build_id = b.id19 JOIN rating_build rb ON b.id = rb.build_id25 JOIN build_component bc ON c.id = bc.component_id 26 JOIN build b ON bc.build_id = b.id 27 JOIN rating_build rb ON b.id = rb.build_id 20 28 WHERE b.created_at >= CURRENT_DATE - INTERVAL '1 year' 21 29 GROUP BY c.type, c.brand, c.name 22 HAVING avg_build_rating >= 4.530 HAVING AVG(rb.value) >= 4.5 23 31 ORDER BY usage_count DESC, avg_build_rating DESC 24 LIMIT 20; 32 LIMIT 15; 33 $$; 25 34 }}} 26 35
