Prevent penalties from resulting in negative marks
1 parent 3bc33df commit da15aa38f31f278105cacf91b37eae6614460548
Mark George authored on 5 Oct 2023
Showing 1 changed file
View
16
sql/schema.sql
GROUP BY Submission_id;
 
-- version to use when bonus contributes to other assessment (maximum mark CAN be exceeded)
CREATE OR REPLACE VIEW Mark AS
SELECT Weighted_Normal.Submission_ID,
Cast(Round(Mark - Penalty, 3) as NUMERIC(7,3)) AS Mark
SELECT
Weighted_Normal.Submission_ID,
case when mark - penalty > 0
then cast(round(Mark - Penalty,3) as NUMERIC(7,3))
else 0
end as Mark
FROM Weighted_Normal
INNER JOIN Weighted_Penalty USING (Submission_ID);
 
INNER JOIN Weighted_Penalty USING (Submission_ID)
 
-- version to use when bonus contributes only to this assessment (maximum mark can not
-- be exceeded)
-- CREATE VIEW mark