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

math added

parent b30e35cb
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@ CREATE TABLE `Sessions`(
occuredOn date,
FOREIGN KEY (leaderID) REFERENCES Volunteers(VolunteerID),
maxAttendees int(10),
ageGroup int(3),
groupid varchar(40),
reviewOfProgression varchar(400),
reviewOfstaffSafety varchar(400),
......@@ -163,6 +164,28 @@ BEGIN
END$$
DELIMITER ;
drop procedure if exists VoltoStuRatio;
delimiter $$
CREATE PROCEDURE VoltoStuRatio(
IN ageGroup int(3),
IN noOfVols int(10))
BEGIN
IF ageGroup=1
THEN
SELECT 5 * noOfVols;
ELSEIF ageGroup=2
then
select 8 * noOfVols;
ELSEIF ageGroup=3
THEN
select 12 * noOfVols;
END IF;
END$$
DELIMITER ;
drop procedure if exists addBadgereq;
delimiter $$
CREATE PROCEDURE addBadgereq(
......@@ -302,6 +325,7 @@ CREATE PROCEDURE addSession(
IN duration int(10),
IN learderID varchar(40),
IN OccuredOn date,
IN ageGroup int(3),
IN groupID varchar(40))
BEGIN
......@@ -309,8 +333,8 @@ BEGIN
BEGIN
SELECT 'User already exists' as ERROR ;
END;
INSERT INTO Sessions(SessionID,location,duration,OccuredOn,groupID,leaderID) values
(md5(concat(occuredOn,groupID)),location,duration, OccuredOn,groupID,learderID);
INSERT INTO Sessions(SessionID,location,duration,OccuredOn,groupID,leaderID,ageGroup) values
(md5(concat(occuredOn,groupID)),location,duration, OccuredOn,groupID,learderID,ageGroup);
call volunteerattends(learderID,md5(concat(occuredOn,groupID)));
END$$
DELIMITER ;
......@@ -327,6 +351,29 @@ BEGIN
END$$
DELIMITER ;
drop procedure if exists addToGroup;
delimiter $$
CREATE PROCEDURE addToGroup(
IN grapeID varchar(40))
BEGIN
select count(distinct volunteerID) into @noOfVols from volunteerattendance as v0
where grapeID in (select groupID from Sessions as s0
where v0.sessionID = s0.sessionID And
date_add(s0.OccuredOn, interval 14 day) > CURDATE() = 1) ;
select count(*)*(SELECT ageGroup from Sessions where groupID=grapeID limit 1)
from students as stu0 where grapeID in
(select groupID from sessions as s2 where stu0.studentID in
(select studentID from StudentAttendance as att0 where stu0.studentID=att0.StudentID));
-- select @noOfStus;
-- UPDATE WaitList as wl0,students as stu2
-- UPDATE student set groupID =groupID where true;
END$$
DELIMITER ;
drop procedure if exists updateDBS;
delimiter $$
CREATE PROCEDURE updateDBS(
......@@ -395,14 +442,16 @@ call addVolunteer("timothy","jones",'bob@bbc.co.uk','8e301d6e513165a9c0b6b9a2b10
call updateSG('419fd9859978a9bf79df4ff16c99c5f9',"2020-04-09");
call updateDBS('419fd9859978a9bf79df4ff16c99c5f9',"2021-09-09");
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2023-02-03','');
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2023-02-03',8,'41');
call ReviewSession(md5('2023-02-03'),"it was ok","idk");
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2023-01-03','');
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2023-01-03',8,'41');
call ReviewSession(md5('2023-01-03'),"it was ok","idk");
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2022-11-03','');
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2022-12-03','');
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2022-11-03',8,'41');
call addSession("computer lab",3,'419fd9859978a9bf79df4ff16c99c5f9','2023-04-16',8,'41');
CALL STUDENTATTENDS('562fe5b6c65003a11148594678c42b90','94b21f931d888fefd4da7a07c01dff4a');
call studentattends('313b6d9a06c3a0618f72ec75c082b6a4','94b21f931d888fefd4da7a07c01dff4a');
call viewVolunteer('');
select * from Sessions;
-- call viewCheckExpiries();
-- select * from volunteers;
select * from sessions;
select * from students;
call viewCheckExpiries();
call addToGroup('41');
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