Changes between Initial Version and Version 1 of ViewBuilds


Ignore:
Timestamp:
12/28/25 23:14:05 (10 hours ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ViewBuilds

    v1 v1  
     1== User opens dashboard ==
     2
     3=== Actors ===
     4Guest, User, Admin
     5
     6=== Scenario ===
     71. The user clicks on the "COMPLETED BUILDS" button
     82. A new page with all the completed and approved builds is displayed
     93. The user can sort by creation date, price and search by name
     10
     11{{{
     12SELECT
     13  b.id,
     14  b.user_id,
     15  b.name,
     16  b.created_at,
     17  b.total_price,
     18  COALESCE(AVG(rb.value::float), 0) AS avgRating
     19FROM build AS b
     20LEFT JOIN rating_build AS rb
     21  ON b.id = rb.build_id
     22WHERE
     23  b.is_approved = true
     24  AND b.name ILIKE ('%' || $q || '%')
     25GROUP BY
     26  b.id, b.user_id, b.name, b.created_at, b.total_price
     27ORDER BY
     28  CASE WHEN $sort = 'price_asc'   THEN b.total_price END ASC,
     29  CASE WHEN $sort = 'price_desc'  THEN b.total_price END DESC,
     30  CASE WHEN $sort = 'rating_desc' THEN COALESCE(AVG(rb.value::float), 0) END DESC,
     31  CASE WHEN $sort = 'oldest'      THEN b.created_at END ASC,
     32  CASE WHEN $sort = 'newest'      THEN b.created_at END DESC,
     33  b.created_at DESC
     34LIMIT COALESCE($limit, 100);
     35
     36}}}