| | 1 | == Leaving a Review |
| | 2 | |
| | 3 | ==== Actors: **Registered Shopper** |
| | 4 | |
| | 5 | **1.** The user wants to submit a review after for their order. |
| | 6 | |
| | 7 | **2.** System checks if order is completed, but not canceled. |
| | 8 | |
| | 9 | {{{#!sql |
| | 10 | SELECT CASE |
| | 11 | WHEN EXISTS ( |
| | 12 | SELECT 1 |
| | 13 | FROM order |
| | 14 | WHERE order_num = '0022025000001' AND (status='delivered') |
| | 15 | ) THEN 'Yes' |
| | 16 | ELSE 'No' |
| | 17 | END AS has_review_permission; |
| | 18 | |
| | 19 | }}} |
| | 20 | |
| | 21 | **3.*** The application inserts the review into {{{review}}}. |
| | 22 | |
| | 23 | {{{#!sql |
| | 24 | INSERT INTO review (order_num, comment, rating, last_mod_date) VALUES |
| | 25 | ('00125100001', 'Excellent quality!', 5, CURRENT_TIMESTAMP); |
| | 26 | |
| | 27 | }}} |