Skip to content

Commit

Permalink
CHG significantly reduce testing over logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wabscale committed Sep 2, 2022
1 parent 1fbbe18 commit 40457d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions api/anubis/lms/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,15 @@ def reject_late_submission(submission: Submission):
db.session.add(submission)


def init_submission(submission: Submission, commit: bool = True):
def init_submission(submission: Submission, commit: bool = True, verbose: bool = True):
"""
Create adjacent submission models.
:return:
"""

logger.debug("initializing submission {}".format(submission.id))
if verbose:
logger.debug("initializing submission {}".format(submission.id))

# If the models already exist, yeet
if len(submission.test_results) != 0:
Expand All @@ -325,7 +326,8 @@ def init_submission(submission: Submission, commit: bool = True):
# Find tests for the current assignment
tests = AssignmentTest.query.filter_by(assignment_id=submission.assignment_id).all()

logger.debug("found tests: {}".format(list(map(lambda x: x.data, tests))))
if verbose:
logger.debug("found tests: {}".format(list(map(lambda x: x.data, tests))))

for test in tests:
tr = SubmissionTestResult(submission_id=submission.id, assignment_test_id=test.id)
Expand Down
2 changes: 1 addition & 1 deletion api/anubis/utils/testing/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def init_submissions(submissions):

# Init models
for submission in submissions:
init_submission(submission, commit=False)
init_submission(submission, commit=False, verbose=False)
db.session.commit()

for submission in submissions:
Expand Down

0 comments on commit 40457d6

Please sign in to comment.