diff --git a/C22063583-report.docx b/C22063583-report.docx new file mode 100644 index 0000000000000000000000000000000000000000..6d5c8872bfd045e15f7949d0d4b64c1df4e420fa Binary files /dev/null and b/C22063583-report.docx differ diff --git a/createdb.sql b/createdb.sql index 1d8bd48a1f2bb3518516e7d6ad7f337d7678a1c9..280ee71e39177fb98bb82b2174f2384fe6138d67 100644 --- a/createdb.sql +++ b/createdb.sql @@ -1,5 +1,5 @@ -- this script is made out of 2 parts building the db --- and testing it I would reccomend looking at the comments of the testing +-- 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 diff --git a/er2 diagram.png b/er2 diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..1b03b746e0366868ff59bf5a4b8729b7e2809657 Binary files /dev/null and b/er2 diagram.png differ diff --git a/~$2063583-report.docx b/~$2063583-report.docx new file mode 100644 index 0000000000000000000000000000000000000000..89f60653697cbdfea04930afc25b36a1b8dbb2ac Binary files /dev/null and b/~$2063583-report.docx differ diff --git a/~WRL0675.tmp b/~WRL0675.tmp new file mode 100644 index 0000000000000000000000000000000000000000..9ad03b34f84e5eca2bdb7f96f0a9eaf8dc2e1753 Binary files /dev/null and b/~WRL0675.tmp differ