Skip to content
Snippets Groups Projects
Commit d0239ce8 authored by Finlay White's avatar Finlay White :speech_balloon:
Browse files

WORD

parent 17ed9d59
No related branches found
No related tags found
No related merge requests found
File added
-- this script is made out of 2 parts building the db
-- and testing it I would reccomend looking at the comments of the testing
-- section as it runs for an explanation of whats happpening
DROP SCHEMA IF EXISTS `SuperGeeks`;
......@@ -110,7 +110,7 @@ CREATE TABLE `Badge`(
DROP TABLE IF EXISTS `BadgeAwarded`;
CREATE TABLE `BadgeAwarded`(
awardedID varchar(40),
awardedID varchar(40) unique primary key,
awardedto varchar(40),
evidence varchar(1000),
awardedby varchar(40),
......@@ -313,6 +313,22 @@ BEGIN
END$$
DELIMITER ;
drop procedure if exists `addPriorty`;
delimiter $$
CREATE PROCEDURE addPriorty(
-- addsMorePrioity to a specific student
IN studentvID varchar(40),
IN PriotityEffect int(2))
BEGIN
DECLARE EXIT HANDLER FOR 1062
BEGIN
SELECT 'This student is already on a wait list' as ERROR ;
END;
update WaitList set dateJoined=date_sub(dateJoined, interval PriotityEffect month) where studentID=studentvID;
END$$
DELIMITER ;
drop procedure if exists addStudent;
delimiter $$
......@@ -625,8 +641,8 @@ call addParent("jeff","Jones","email@realemail.com","veryStrongPassw0rd",0235825
call addParent("tim","buckley","loss@realemail.com","veryStrongPassw0rd",118254);
select * from parents;
do sleep(2);
-- this is how we add parents to the db notice how it automatically hashes
-- to create an ID based on the information
-- this is how we add parents to the db notice how it automatically hashes
-- to create an ID based on the information
call addBadge("real badge","respond with placeholder evidence in <>");
call addBadge("test badge","do not respond with hello world");
select * from badge;
......@@ -655,19 +671,19 @@ do sleep(5);
call applytogroup('4208a177bd0e3e81b682640e2c8078dd','41',5);
call addVolunteer("timothy","jones",'bob@bbc.co.uk','8e301d6e513165a9c0b6b9a2b10c8305',"0777008913");
call applytogroup('b6e14bcdd6a79c8f8cd9fcef3be5f00b', '41',5);
do sleep(1);
call applytogroup('7bd99d2efd6611161736f780a042f978','41',5);
do sleep(1);
-- 2 people were already in the group and 4 students have applied
-- tom jones was added last so he will be the one who will have to miss out
-- (tom's hashed id starts with 031f)
-- tom jones was added last so he would be the one who will have to miss out
-- however Tom has been given priority so tibalt with id 7bd will miss out
call applytogroup('031f0ba110c9683bf4cf5d2836b32a95',41,5);
call addPriorty('031f0ba110c9683bf4cf5d2836b32a95',2);
call updateSG('419fd9859978a9bf79df4ff16c99c5f9',"2010-04-09");
call updateDBS('419fd9859978a9bf79df4ff16c99c5f9',"2021-09-09");
call viewCheckExpiries();
-- hmmm it appears volunteer tim doesn't have a valid sg check
--
--
call updateSG('419fd9859978a9bf79df4ff16c99c5f9',"2023-04-04");
-- now its valid
......@@ -684,7 +700,7 @@ CALL STUDENTATTENDS('0ad073b3372ad0c243e6d465a2318568','94b21f931d888fefd4da7a07
call studentattends('313b6d9a06c3a0618f72ec75c082b6a4','94b21f931d888fefd4da7a07c01dff4a');
call viewVolunteer('');
-- time volunteer has spent has been calculated from
-- time volunteer has spent has been calculated from
do sleep(3);
select * from students;
do sleep(3);
......@@ -695,7 +711,7 @@ do sleep(3);
select * from waitlist;
select * from students;
call StudentBadgeApply( '0ad073b3372ad0c243e6d465a2318568','fb635b87d668b2bbcc6a0b0a2f6adc32','<placeholder evidence that is what is needed>');
call StudentBadgeApply( '0ad073b3372ad0c243e6d465a2318568','fb635b87d668b2bbcc6a0b0a2f6adc32','<placeholder evidence that is what is needed>(correct)');
call StudentBadgeApply( '0ad073b3372ad0c243e6d465a2318568','fc1c7ce79f0265dd918c07588166cd03','hello world (incorrect)');
-- bobby jones with hash id of 0ad is applying for a badge
-- with the correct evidence to sign them off
......
er2 diagram.png

341 KiB

File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment