diff --git a/sql/schema.sql b/sql/schema.sql index 677dffa..a3197e1 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -131,11 +131,14 @@ -- 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)