== User opens dashboard == === Actors === Guest, User, Admin === Scenario === 1. The user clicks on the "COMPLETED BUILDS" button 2. A new page with all the completed and approved builds is displayed 3. The user can sort by creation date, price and search by name {{{ SELECT b.id, b.user_id, b.name, b.created_at, b.total_price, COALESCE(AVG(rb.value::float), 0) AS avgRating FROM build AS b LEFT JOIN rating_build AS rb ON b.id = rb.build_id WHERE b.is_approved = true AND b.name ILIKE ('%' || $q || '%') GROUP BY b.id, b.user_id, b.name, b.created_at, b.total_price ORDER BY CASE WHEN $sort = 'price_asc' THEN b.total_price END ASC, CASE WHEN $sort = 'price_desc' THEN b.total_price END DESC, CASE WHEN $sort = 'rating_desc' THEN COALESCE(AVG(rb.value::float), 0) END DESC, CASE WHEN $sort = 'oldest' THEN b.created_at END ASC, CASE WHEN $sort = 'newest' THEN b.created_at END DESC, b.created_at DESC LIMIT COALESCE($limit, 100); }}}