Skip to content

Commit

Permalink
Validate that there's at least one grade while creating new GradeSyncs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Sep 25, 2024
1 parent 288b5cb commit 57d0e3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lms/views/dashboard/api/grading.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from marshmallow import Schema, fields
from marshmallow import Schema, fields, validate
from pyramid.httpexceptions import HTTPNotFound
from pyramid.view import view_config
from sqlalchemy import select
Expand All @@ -21,7 +21,9 @@ class _GradeSchema(Schema):


class AutoGradeSyncSchema(JSONPyramidRequestSchema):
grades = fields.List(fields.Nested(_GradeSchema), required=True)
grades = fields.List(
fields.Nested(_GradeSchema), required=True, validate=validate.Length(min=1)
)


class DashboardGradingViews:
Expand Down

0 comments on commit 57d0e3d

Please sign in to comment.