mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 01:47:41 +00:00
Update to SQL objects and CSS adjustment
This commit is contained in:
@@ -2,16 +2,14 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetAll`()
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetAll`()
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
id_goal,
|
goalId,
|
||||||
id_goal_parent,
|
goalParentId,
|
||||||
id_student,
|
studentId,
|
||||||
id_user_created,
|
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
category,
|
category,
|
||||||
created_at,
|
progressEventCount
|
||||||
updated_at
|
FROM v_goal_card
|
||||||
FROM goal
|
ORDER BY goalId;
|
||||||
ORDER BY id_goal;
|
|
||||||
END;;
|
END;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|||||||
@@ -2,17 +2,15 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetById`(IN p_id_goal CHAR(36))
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_GetById`(IN p_id_goal CHAR(36))
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
id_goal,
|
goalId,
|
||||||
id_goal_parent,
|
goalParentId,
|
||||||
id_student,
|
studentId,
|
||||||
id_user_created,
|
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
category,
|
category,
|
||||||
created_at,
|
progressEventCount
|
||||||
updated_at
|
FROM v_goal_card
|
||||||
FROM goal
|
WHERE goalId = p_id_goal
|
||||||
WHERE id_goal = p_id_goal
|
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
END;;
|
END;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ProgressEvent_Insert`(
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ProgressEvent_Insert`(
|
||||||
IN p_id_progress_event CHAR(36),
|
IN p_id_progress_event CHAR(36),
|
||||||
IN p_id_student CHAR(36),
|
|
||||||
IN p_id_goal CHAR(36),
|
IN p_id_goal CHAR(36),
|
||||||
IN p_id_user_created CHAR(36),
|
IN p_id_user_created CHAR(36),
|
||||||
IN p_content TEXT,
|
IN p_content TEXT,
|
||||||
@@ -11,7 +10,6 @@ BEGIN
|
|||||||
INSERT INTO progress_event
|
INSERT INTO progress_event
|
||||||
(
|
(
|
||||||
id_progress_event,
|
id_progress_event,
|
||||||
id_student,
|
|
||||||
id_goal,
|
id_goal,
|
||||||
id_user_created,
|
id_user_created,
|
||||||
content,
|
content,
|
||||||
@@ -22,7 +20,6 @@ BEGIN
|
|||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
p_id_progress_event,
|
p_id_progress_event,
|
||||||
p_id_student,
|
|
||||||
p_id_goal,
|
p_id_goal,
|
||||||
p_id_user_created,
|
p_id_user_created,
|
||||||
p_content,
|
p_content,
|
||||||
@@ -32,7 +29,6 @@ BEGIN
|
|||||||
);
|
);
|
||||||
SELECT
|
SELECT
|
||||||
id_progress_event,
|
id_progress_event,
|
||||||
id_student,
|
|
||||||
id_goal,
|
id_goal,
|
||||||
id_user_created,
|
id_user_created,
|
||||||
content,
|
content,
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetAll`()
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetAll`()
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
id_student,
|
studentId,
|
||||||
id_program,
|
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
expectedGradDate,
|
||||||
enrollment_date,
|
lastEntryDate,
|
||||||
expected_grad,
|
goalCount,
|
||||||
created_at
|
progressEventCount
|
||||||
FROM student
|
FROM v_student_card
|
||||||
ORDER BY id_student;
|
ORDER BY studentId;
|
||||||
END;;
|
END;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetById`(IN p_id_student CHAR(36))
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetById`(IN p_id_student CHAR(36))
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
id_student,
|
studentId,
|
||||||
id_program,
|
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
expectedGradDate,
|
||||||
enrollment_date,
|
lastEntryDate,
|
||||||
expected_grad,
|
goalCount,
|
||||||
created_at
|
progressEventCount
|
||||||
FROM student
|
FROM v_student_card
|
||||||
WHERE id_student = p_id_student
|
WHERE studentId = p_id_student
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
END;;
|
END;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetWithAssignments`(
|
|||||||
IN p_id_user CHAR(36)
|
IN p_id_user CHAR(36)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Result set 1: All students in the program
|
-- Result set 1: All students in the program (card shape)
|
||||||
SELECT
|
SELECT
|
||||||
s.id_student,
|
vc.studentId,
|
||||||
s.id_program,
|
vc.identifier,
|
||||||
s.identifier,
|
vc.expectedGradDate,
|
||||||
s.program_year,
|
vc.lastEntryDate,
|
||||||
s.enrollment_date,
|
vc.goalCount,
|
||||||
s.expected_grad,
|
vc.progressEventCount
|
||||||
s.created_at
|
FROM v_student_card vc
|
||||||
FROM student s
|
INNER JOIN student s ON s.id_student = vc.studentId
|
||||||
WHERE s.id_program = p_id_program
|
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
|
-- Result set 2: user_student assignments for the requesting user in this program
|
||||||
SELECT
|
SELECT
|
||||||
us.id_user_student,
|
us.id_user_student,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
CREATE TABLE `progress_event` (
|
CREATE TABLE `progress_event` (
|
||||||
`id_progress_event` char(36) NOT NULL,
|
`id_progress_event` char(36) NOT NULL,
|
||||||
`id_student` char(36) DEFAULT NULL,
|
|
||||||
`id_goal` char(36) DEFAULT NULL,
|
`id_goal` char(36) DEFAULT NULL,
|
||||||
`id_user_created` char(36) DEFAULT NULL,
|
`id_user_created` char(36) DEFAULT NULL,
|
||||||
`content` text,
|
`content` text,
|
||||||
@@ -8,10 +7,8 @@ CREATE TABLE `progress_event` (
|
|||||||
`created_at` timestamp NULL DEFAULT NULL,
|
`created_at` timestamp NULL DEFAULT NULL,
|
||||||
`updated_at` timestamp NULL DEFAULT NULL,
|
`updated_at` timestamp NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (`id_progress_event`),
|
PRIMARY KEY (`id_progress_event`),
|
||||||
KEY `progress_event_ibfk_1` (`id_student`),
|
|
||||||
KEY `progress_event_ibfk_2` (`id_goal`),
|
KEY `progress_event_ibfk_2` (`id_goal`),
|
||||||
KEY `progress_event_ibfk_3` (`id_user_created`),
|
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_2` FOREIGN KEY (`id_goal`) REFERENCES `goal` (`id_goal`),
|
||||||
CONSTRAINT `progress_event_ibfk_3` FOREIGN KEY (`id_user_created`) REFERENCES `user` (`id_user`)
|
CONSTRAINT `progress_event_ibfk_3` FOREIGN KEY (`id_user_created`) REFERENCES `user` (`id_user`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|||||||
@@ -1,18 +1,5 @@
|
|||||||
CREATE OR REPLACE VIEW `v_goal_card` AS
|
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `winstudentgoaltracker`.`v_goal_card` AS
|
||||||
SELECT
|
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`
|
||||||
goal.`id_goal` AS `goalId`,
|
from (`winstudentgoaltracker`.`goal`
|
||||||
goal.`id_goal_parent` AS `goalParentId`,
|
left
|
||||||
goal.`id_student` AS `studentId`,
|
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`;
|
||||||
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`;
|
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
CREATE OR REPLACE VIEW `v_student_card` AS
|
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `winstudentgoaltracker`.`v_student_card` AS
|
||||||
SELECT
|
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`
|
||||||
s.`id_student` AS `studentId`,
|
from ((`winstudentgoaltracker`.`student` `s`
|
||||||
s.`identifier` AS `identifier`,
|
left
|
||||||
s.`expected_grad` AS `expectedGradDate`,
|
join `winstudentgoaltracker`.`goal` `g` on((`g`.`id_student` = `s`.`id_student`)))
|
||||||
MAX(pe.`created_at`) AS `lastEntryDate`,
|
left
|
||||||
COUNT(DISTINCT g.`id_goal`) AS `goalCount`,
|
join `winstudentgoaltracker`.`progress_event` `pe` on((`pe`.`id_goal` = `g`.`id_goal`))) group by `s`.`id_student`,`s`.`identifier`,`s`.`expected_grad`;
|
||||||
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`;
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.page {
|
.page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100dvh;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100dvh;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
@@ -163,4 +163,4 @@ dd {
|
|||||||
.mono {
|
.mono {
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||||
font-size: 0.8125rem;
|
font-size: 0.8125rem;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user