From 5b7bd8cfb42ab0e8b4d4187726bb3ffe09993157 Mon Sep 17 00:00:00 2001 From: ivan-pelly Date: Tue, 3 Mar 2026 11:48:10 -0800 Subject: [PATCH] Update to SQL objects and CSS adjustment --- db/Objects/procedures/sp_Goal_GetAll.sql | 14 +++++------ db/Objects/procedures/sp_Goal_GetById.sql | 14 +++++------ .../procedures/sp_ProgressEvent_Insert.sql | 4 ---- db/Objects/procedures/sp_Student_GetAll.sql | 15 ++++++------ db/Objects/procedures/sp_Student_GetById.sql | 15 ++++++------ .../sp_Student_GetWithAssignments.sql | 20 ++++++++-------- db/Objects/tables/progress_event.sql | 3 --- db/Objects/views/v_goal_card.sql | 23 ++++-------------- db/Objects/views/v_student_card.sql | 24 ++++++------------- .../src/app/mobile/pages/home/home.scss | 2 +- .../src/app/shared/pages/login/login.css | 4 ++-- 11 files changed, 51 insertions(+), 87 deletions(-) diff --git a/db/Objects/procedures/sp_Goal_GetAll.sql b/db/Objects/procedures/sp_Goal_GetAll.sql index 146549d..357163d 100644 --- a/db/Objects/procedures/sp_Goal_GetAll.sql +++ b/db/Objects/procedures/sp_Goal_GetAll.sql @@ -2,16 +2,14 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetAll`() BEGIN SELECT - id_goal, - id_goal_parent, - id_student, - id_user_created, + goalId, + goalParentId, + studentId, title, description, category, - created_at, - updated_at - FROM goal - ORDER BY id_goal; + progressEventCount + FROM v_goal_card + ORDER BY goalId; END;; DELIMITER ; diff --git a/db/Objects/procedures/sp_Goal_GetById.sql b/db/Objects/procedures/sp_Goal_GetById.sql index cafb462..1eaae5d 100644 --- a/db/Objects/procedures/sp_Goal_GetById.sql +++ b/db/Objects/procedures/sp_Goal_GetById.sql @@ -2,17 +2,15 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetById`(IN p_id_goal CHAR(36)) BEGIN SELECT - id_goal, - id_goal_parent, - id_student, - id_user_created, + goalId, + goalParentId, + studentId, title, description, category, - created_at, - updated_at - FROM goal - WHERE id_goal = p_id_goal + progressEventCount + FROM v_goal_card + WHERE goalId = p_id_goal LIMIT 1; END;; DELIMITER ; diff --git a/db/Objects/procedures/sp_ProgressEvent_Insert.sql b/db/Objects/procedures/sp_ProgressEvent_Insert.sql index 2c0dfc1..b8c2235 100644 --- a/db/Objects/procedures/sp_ProgressEvent_Insert.sql +++ b/db/Objects/procedures/sp_ProgressEvent_Insert.sql @@ -1,7 +1,6 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sp_ProgressEvent_Insert`( IN p_id_progress_event CHAR(36), - IN p_id_student CHAR(36), IN p_id_goal CHAR(36), IN p_id_user_created CHAR(36), IN p_content TEXT, @@ -11,7 +10,6 @@ BEGIN INSERT INTO progress_event ( id_progress_event, - id_student, id_goal, id_user_created, content, @@ -22,7 +20,6 @@ BEGIN VALUES ( p_id_progress_event, - p_id_student, p_id_goal, p_id_user_created, p_content, @@ -32,7 +29,6 @@ BEGIN ); SELECT id_progress_event, - id_student, id_goal, id_user_created, content, diff --git a/db/Objects/procedures/sp_Student_GetAll.sql b/db/Objects/procedures/sp_Student_GetAll.sql index f0b31cf..af0d66c 100644 --- a/db/Objects/procedures/sp_Student_GetAll.sql +++ b/db/Objects/procedures/sp_Student_GetAll.sql @@ -2,14 +2,13 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetAll`() BEGIN SELECT - id_student, - id_program, + studentId, identifier, - program_year, - enrollment_date, - expected_grad, - created_at - FROM student - ORDER BY id_student; + expectedGradDate, + lastEntryDate, + goalCount, + progressEventCount + FROM v_student_card + ORDER BY studentId; END;; DELIMITER ; diff --git a/db/Objects/procedures/sp_Student_GetById.sql b/db/Objects/procedures/sp_Student_GetById.sql index 3017116..8ff9d8d 100644 --- a/db/Objects/procedures/sp_Student_GetById.sql +++ b/db/Objects/procedures/sp_Student_GetById.sql @@ -2,15 +2,14 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetById`(IN p_id_student CHAR(36)) BEGIN SELECT - id_student, - id_program, + studentId, identifier, - program_year, - enrollment_date, - expected_grad, - created_at - FROM student - WHERE id_student = p_id_student + expectedGradDate, + lastEntryDate, + goalCount, + progressEventCount + FROM v_student_card + WHERE studentId = p_id_student LIMIT 1; END;; DELIMITER ; diff --git a/db/Objects/procedures/sp_Student_GetWithAssignments.sql b/db/Objects/procedures/sp_Student_GetWithAssignments.sql index cd2a4e3..abf28b1 100644 --- a/db/Objects/procedures/sp_Student_GetWithAssignments.sql +++ b/db/Objects/procedures/sp_Student_GetWithAssignments.sql @@ -4,18 +4,18 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetWithAssignments`( IN p_id_user CHAR(36) ) BEGIN - -- Result set 1: All students in the program + -- Result set 1: All students in the program (card shape) SELECT - s.id_student, - s.id_program, - s.identifier, - s.program_year, - s.enrollment_date, - s.expected_grad, - s.created_at - FROM student s + vc.studentId, + vc.identifier, + vc.expectedGradDate, + vc.lastEntryDate, + vc.goalCount, + vc.progressEventCount + FROM v_student_card vc + INNER JOIN student s ON s.id_student = vc.studentId WHERE s.id_program = p_id_program - ORDER BY s.id_student; + ORDER BY vc.studentId; -- Result set 2: user_student assignments for the requesting user in this program SELECT us.id_user_student, diff --git a/db/Objects/tables/progress_event.sql b/db/Objects/tables/progress_event.sql index e1cec6b..6f04917 100644 --- a/db/Objects/tables/progress_event.sql +++ b/db/Objects/tables/progress_event.sql @@ -1,6 +1,5 @@ CREATE TABLE `progress_event` ( `id_progress_event` char(36) NOT NULL, - `id_student` char(36) DEFAULT NULL, `id_goal` char(36) DEFAULT NULL, `id_user_created` char(36) DEFAULT NULL, `content` text, @@ -8,10 +7,8 @@ CREATE TABLE `progress_event` ( `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id_progress_event`), - KEY `progress_event_ibfk_1` (`id_student`), KEY `progress_event_ibfk_2` (`id_goal`), KEY `progress_event_ibfk_3` (`id_user_created`), - CONSTRAINT `progress_event_ibfk_1` FOREIGN KEY (`id_student`) REFERENCES `student` (`id_student`), CONSTRAINT `progress_event_ibfk_2` FOREIGN KEY (`id_goal`) REFERENCES `goal` (`id_goal`), CONSTRAINT `progress_event_ibfk_3` FOREIGN KEY (`id_user_created`) REFERENCES `user` (`id_user`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; diff --git a/db/Objects/views/v_goal_card.sql b/db/Objects/views/v_goal_card.sql index 58fd4e4..91a48f3 100644 --- a/db/Objects/views/v_goal_card.sql +++ b/db/Objects/views/v_goal_card.sql @@ -1,18 +1,5 @@ -CREATE OR REPLACE VIEW `v_goal_card` AS -SELECT - goal.`id_goal` AS `goalId`, - goal.`id_goal_parent` AS `goalParentId`, - goal.`id_student` AS `studentId`, - goal.`title` AS `title`, - goal.`description` AS `description`, - goal.`category` AS `category`, - COUNT(pe.`id_progress_event`) AS `progressEventCount` -FROM `goal` -LEFT JOIN `progress_event` pe ON pe.`id_goal` = goal.`id_goal` -GROUP BY - goal.`id_goal`, - goal.`id_goal_parent`, - goal.`id_student`, - goal.`title`, - goal.`description`, - goal.`category`; +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `winstudentgoaltracker`.`v_goal_card` AS +select `winstudentgoaltracker`.`goal`.`id_goal` AS `goalId`,`winstudentgoaltracker`.`goal`.`id_goal_parent` AS `goalParentId`,`winstudentgoaltracker`.`goal`.`id_student` AS `studentId`,`winstudentgoaltracker`.`goal`.`title` AS `title`,`winstudentgoaltracker`.`goal`.`description` AS `description`,`winstudentgoaltracker`.`goal`.`category` AS `category`,count(`pe`.`id_progress_event`) AS `progressEventCount` +from (`winstudentgoaltracker`.`goal` +left +join `winstudentgoaltracker`.`progress_event` `pe` on((`pe`.`id_goal` = `winstudentgoaltracker`.`goal`.`id_goal`))) group by `winstudentgoaltracker`.`goal`.`id_goal`,`winstudentgoaltracker`.`goal`.`id_goal_parent`,`winstudentgoaltracker`.`goal`.`id_student`,`winstudentgoaltracker`.`goal`.`title`,`winstudentgoaltracker`.`goal`.`description`,`winstudentgoaltracker`.`goal`.`category`; diff --git a/db/Objects/views/v_student_card.sql b/db/Objects/views/v_student_card.sql index 3277fd7..4a1647c 100644 --- a/db/Objects/views/v_student_card.sql +++ b/db/Objects/views/v_student_card.sql @@ -1,17 +1,7 @@ -CREATE OR REPLACE VIEW `v_student_card` AS -SELECT - s.`id_student` AS `studentId`, - s.`identifier` AS `identifier`, - s.`expected_grad` AS `expectedGradDate`, - MAX(pe.`created_at`) AS `lastEntryDate`, - COUNT(DISTINCT g.`id_goal`) AS `goalCount`, - COUNT(DISTINCT pe.`id_progress_event`) AS `progressEventCount` -FROM `student` s -LEFT JOIN `goal` g - ON g.`id_student` = s.`id_student` -LEFT JOIN `progress_event` pe - ON pe.`id_goal` = g.`id_goal` -GROUP BY - s.`id_student`, - s.`identifier`, - s.`expected_grad`; +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `winstudentgoaltracker`.`v_student_card` AS +select `s`.`id_student` AS `studentId`,`s`.`identifier` AS `identifier`,`s`.`expected_grad` AS `expectedGradDate`,max(`pe`.`created_at`) AS `lastEntryDate`,count(distinct `g`.`id_goal`) AS `goalCount`,count(distinct `pe`.`id_progress_event`) AS `progressEventCount` +from ((`winstudentgoaltracker`.`student` `s` +left +join `winstudentgoaltracker`.`goal` `g` on((`g`.`id_student` = `s`.`id_student`))) +left +join `winstudentgoaltracker`.`progress_event` `pe` on((`pe`.`id_goal` = `g`.`id_goal`))) group by `s`.`id_student`,`s`.`identifier`,`s`.`expected_grad`; diff --git a/ui/winstudentgoaltracker/src/app/mobile/pages/home/home.scss b/ui/winstudentgoaltracker/src/app/mobile/pages/home/home.scss index 41d718a..69a4bbb 100644 --- a/ui/winstudentgoaltracker/src/app/mobile/pages/home/home.scss +++ b/ui/winstudentgoaltracker/src/app/mobile/pages/home/home.scss @@ -7,7 +7,7 @@ .page { display: flex; flex-direction: column; - height: 100vh; + height: 100dvh; background: #f5f5f5; } diff --git a/ui/winstudentgoaltracker/src/app/shared/pages/login/login.css b/ui/winstudentgoaltracker/src/app/shared/pages/login/login.css index c3b3bfa..554fed0 100644 --- a/ui/winstudentgoaltracker/src/app/shared/pages/login/login.css +++ b/ui/winstudentgoaltracker/src/app/shared/pages/login/login.css @@ -2,7 +2,7 @@ display: flex; justify-content: center; align-items: center; - min-height: 100vh; + min-height: 100dvh; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; padding: 1rem; @@ -163,4 +163,4 @@ dd { .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; -} +} \ No newline at end of file