Changes between Initial Version and Version 1 of UseCase0001


Ignore:
Timestamp:
03/16/26 20:39:33 (5 days ago)
Author:
221511
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0001

    v1 v1  
     1= UC0001: Browse Available Resources =
     2
     3'''Initiating actor:''' Student
     4
     5'''Other actors:''' None
     6
     7A student wants to find resources available for use within the faculty. The student can browse all resources, filter them by resource type or building location, view details of a specific resource including its current reservations, and check whether the resource is free at a desired date and time.
     8
     9== Scenario ==
     10
     11 1. The student opens the resource browser page. The system retrieves all resources grouped by type and displays them.
     12{{{
     13SELECT r.resource_id, r.name, r.description,
     14       r.available_from, r.available_to, r.available_weekends,
     15       rt.type_name, rt.is_physical,
     16       l.building, l.room
     17FROM project.resources r
     18JOIN project.resource_types rt ON r.type_id = rt.type_id
     19LEFT JOIN project.locations l ON r.location_id = l.location_id
     20ORDER BY rt.type_name, r.name;
     21}}}
     22
     23 2. The student selects the filter for resource type ''Computer Laboratory''. The system queries and returns only computer labs.
     24{{{
     25SELECT r.resource_id, r.name, r.description,
     26       r.available_from, r.available_to, r.available_weekends,
     27       l.building, l.room
     28FROM project.resources r
     29JOIN project.resource_types rt ON r.type_id = rt.type_id
     30LEFT JOIN project.locations l ON r.location_id = l.location_id
     31WHERE rt.type_name = 'Computer Laboratory'
     32ORDER BY r.name;
     33}}}
     34
     35 3. The student further filters to show only resources in building ''FINKI-B''. The system narrows the results.
     36{{{
     37SELECT r.resource_id, r.name, r.description,
     38       r.available_from, r.available_to, r.available_weekends,
     39       l.building, l.room
     40FROM project.resources r
     41JOIN project.resource_types rt ON r.type_id = rt.type_id
     42JOIN project.locations l ON r.location_id = l.location_id
     43WHERE rt.type_name = 'Computer Laboratory'
     44  AND l.building = 'FINKI-B'
     45ORDER BY r.name;
     46}}}
     47
     48 4. The student selects ''Programming Lab 1'' (resource_id = 5) to view its details. The system shows the resource information and its upcoming reservations.
     49{{{
     50SELECT r.resource_id, r.name, r.description,
     51       r.available_from, r.available_to, r.available_weekends,
     52       rt.type_name, l.building, l.room
     53FROM project.resources r
     54JOIN project.resource_types rt ON r.type_id = rt.type_id
     55LEFT JOIN project.locations l ON r.location_id = l.location_id
     56WHERE r.resource_id = 5;
     57}}}
     58
     59{{{
     60SELECT res.reservation_id, res.start_time, res.end_time,
     61       res.status, res.purpose
     62FROM project.reservations res
     63WHERE res.resource_id = 5
     64  AND res.status IN ('approved', 'pending')
     65  AND res.end_time > CURRENT_TIMESTAMP
     66ORDER BY res.start_time;
     67}}}
     68
     69 5. The student wants to check if the lab is available on 2026-02-20 from 14:00 to 16:00. The system first verifies the time falls within the resource's daily availability window and that the day is not a weekend (or the resource allows weekends). Then it checks for conflicting reservations.
     70{{{
     71SELECT r.resource_id, r.name
     72FROM project.resources r
     73WHERE r.resource_id = 5
     74  AND r.available_from <= '14:00'::TIME
     75  AND r.available_to >= '16:00'::TIME
     76  AND (r.available_weekends = TRUE
     77       OR EXTRACT(ISODOW FROM DATE '2026-02-20') <= 5);
     78}}}
     79
     80{{{
     81SELECT COUNT(*) AS conflict_count
     82FROM project.reservations res
     83WHERE res.resource_id = 5
     84  AND res.status IN ('approved', 'pending')
     85  AND res.start_time < '2026-02-20 16:00:00'
     86  AND res.end_time > '2026-02-20 14:00:00';
     87}}}
     88
     89 6. The system reports that the resource is available (conflict_count = 0 and the availability window check returned a row). The student can now proceed to make a reservation if permitted.