Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SUPERGEEKS-SQL
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Finlay White
SUPERGEEKS-SQL
Commits
b30e35cb
Commit
b30e35cb
authored
1 year ago
by
Finlay White
Browse files
Options
Downloads
Patches
Plain Diff
Session shenanigans
parent
afdfdb2e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
createdb.sql
+15
-9
15 additions, 9 deletions
createdb.sql
with
15 additions
and
9 deletions
createdb.sql
+
15
−
9
View file @
b30e35cb
...
...
@@ -147,7 +147,7 @@ CREATE PROCEDURE addVolunteer(
IN
lname
varchar
(
35
),
IN
email
varchar
(
320
),
IN
passwerd
varchar
(
70
),
IN
phonenum
int
(
1
0
))
IN
phonenum
varchar
(
2
0
))
BEGIN
DECLARE
EXIT
HANDLER
FOR
1062
...
...
@@ -260,9 +260,9 @@ CREATE PROCEDURE viewVolunteer(
BEGIN
If
LENGTH
(
volunteervID
)
=
0
then
SELECT
s0
.
VolunteerID
,
s0
.
volunteerCode
,
s0
.
fname
,
s0
.
lname
,
s0
.
DBSdue
,
s0
.
SGdue
,
s0
.
emergencycontact
,
s0
.
email
,(
select
sum
(
duration
)
from
Sessions
where
sessionID
in
(
select
sessionID
from
VolunteerAttendance
where
volunteerID
=
s0
.
volunteerID
))
from
volunteers
as
s0
;
SELECT
s0
.
VolunteerID
,
s0
.
volunteerCode
,
s0
.
fname
,
s0
.
lname
,
s0
.
DBSdue
,
s0
.
SGdue
,
s0
.
emergencycontact
,
s0
.
email
,(
select
sum
(
duration
)
from
Sessions
where
sessionID
in
(
select
sessionID
from
VolunteerAttendance
where
volunteerID
=
s0
.
volunteerID
))
as
"time "
from
volunteers
as
s0
;
else
SELECT
s0
.
VolunteerID
,
s0
.
volunteerCode
,
s0
.
fname
,
s0
.
lname
,
s0
.
DBSdue
,
s0
.
SGdue
,
s0
.
emergencycontact
,
s0
.
email
,(
select
sum
(
duration
)
from
Sessions
where
sessionID
in
(
select
sessionID
from
VolunteerAttendance
where
volunteerID
=
s0
.
volunteerID
))
from
volunteers
as
s0
where
volunteerID
=
volunteervID
;
SELECT
s0
.
VolunteerID
,
s0
.
volunteerCode
,
s0
.
fname
,
s0
.
lname
,
s0
.
DBSdue
,
s0
.
SGdue
,
s0
.
emergencycontact
,
s0
.
email
,(
select
sum
(
duration
)
from
Sessions
where
sessionID
in
(
select
sessionID
from
VolunteerAttendance
where
volunteerID
=
s0
.
volunteerID
))
as
"time"
from
volunteers
as
s0
where
volunteerID
=
volunteervID
;
end
if
;
END
$$
DELIMITER
;
...
...
@@ -310,11 +310,11 @@ BEGIN
SELECT
'User already exists'
as
ERROR
;
END
;
INSERT
INTO
Sessions
(
SessionID
,
location
,
duration
,
OccuredOn
,
groupID
,
leaderID
)
values
(
md5
(
concat
(
duration
,
groupID
)),
location
,
OccuredOn
,
groupID
,
leaderID
);
(
md5
(
concat
(
occuredOn
,
groupID
)),
location
,
duration
,
OccuredOn
,
groupID
,
learderID
);
call
volunteerattends
(
learderID
,
md5
(
concat
(
occuredOn
,
groupID
)));
END
$$
DELIMITER
;
drop
procedure
if
exists
ReviewSession
;
delimiter
$$
CREATE
PROCEDURE
ReviewSession
(
...
...
@@ -379,8 +379,7 @@ CREATE PROCEDURE StudentBadgeApply(
BEGIN
INSERT
INTO
StudentAttendance
(
StudentID
,
sessionID
)
values
(
studentID
,
sessionID
);
INSERT
INTO
BadgeAwarded
(
awardedto
,
BadgeAwarded
,
evidence
,
isAwarded
)
values
(
studentID
,
BadgeID
,
badgeEvidence
,
0
);
END
$$
DELIMITER
;
...
...
@@ -396,7 +395,14 @@ call addVolunteer("timothy","jones",'bob@bbc.co.uk','8e301d6e513165a9c0b6b9a2b10
call
updateSG
(
'419fd9859978a9bf79df4ff16c99c5f9'
,
"2020-04-09"
);
call
updateDBS
(
'419fd9859978a9bf79df4ff16c99c5f9'
,
"2021-09-09"
);
call
viewCheckExpiries
();
call
addSession
(
"computer lab"
,
3
,
'419fd9859978a9bf79df4ff16c99c5f9'
,
'2023-02-03'
,
''
);
call
ReviewSession
(
md5
(
'2023-02-03'
),
"it was ok"
,
"idk"
);
call
addSession
(
"computer lab"
,
3
,
'419fd9859978a9bf79df4ff16c99c5f9'
,
'2023-01-03'
,
''
);
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
viewVolunteer
(
''
);
select
*
from
Sessions
;
-- call viewCheckExpiries();
-- select * from volunteers;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment