| Version 1 (modified by , 5 days ago) ( diff ) |
|---|
UC0001: Browse Available Resources
Initiating actor: Student
Other actors: None
A 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.
Scenario
- The student opens the resource browser page. The system retrieves all resources grouped by type and displays them.
SELECT r.resource_id, r.name, r.description, r.available_from, r.available_to, r.available_weekends, rt.type_name, rt.is_physical, l.building, l.room FROM project.resources r JOIN project.resource_types rt ON r.type_id = rt.type_id LEFT JOIN project.locations l ON r.location_id = l.location_id ORDER BY rt.type_name, r.name;
- The student selects the filter for resource type Computer Laboratory. The system queries and returns only computer labs.
SELECT r.resource_id, r.name, r.description, r.available_from, r.available_to, r.available_weekends, l.building, l.room FROM project.resources r JOIN project.resource_types rt ON r.type_id = rt.type_id LEFT JOIN project.locations l ON r.location_id = l.location_id WHERE rt.type_name = 'Computer Laboratory' ORDER BY r.name;
- The student further filters to show only resources in building FINKI-B. The system narrows the results.
SELECT r.resource_id, r.name, r.description, r.available_from, r.available_to, r.available_weekends, l.building, l.room FROM project.resources r JOIN project.resource_types rt ON r.type_id = rt.type_id JOIN project.locations l ON r.location_id = l.location_id WHERE rt.type_name = 'Computer Laboratory' AND l.building = 'FINKI-B' ORDER BY r.name;
- The student selects Programming Lab 1 (resource_id = 5) to view its details. The system shows the resource information and its upcoming reservations.
SELECT r.resource_id, r.name, r.description, r.available_from, r.available_to, r.available_weekends, rt.type_name, l.building, l.room FROM project.resources r JOIN project.resource_types rt ON r.type_id = rt.type_id LEFT JOIN project.locations l ON r.location_id = l.location_id WHERE r.resource_id = 5;
SELECT res.reservation_id, res.start_time, res.end_time,
res.status, res.purpose
FROM project.reservations res
WHERE res.resource_id = 5
AND res.status IN ('approved', 'pending')
AND res.end_time > CURRENT_TIMESTAMP
ORDER BY res.start_time;
- 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.
SELECT r.resource_id, r.name FROM project.resources r WHERE r.resource_id = 5 AND r.available_from <= '14:00'::TIME AND r.available_to >= '16:00'::TIME AND (r.available_weekends = TRUE OR EXTRACT(ISODOW FROM DATE '2026-02-20') <= 5);
SELECT COUNT(*) AS conflict_count
FROM project.reservations res
WHERE res.resource_id = 5
AND res.status IN ('approved', 'pending')
AND res.start_time < '2026-02-20 16:00:00'
AND res.end_time > '2026-02-20 14:00:00';
- 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.
Note:
See TracWiki
for help on using the wiki.
