diff --git a/denis/utilities.py b/denis/utilities.py index 2d777f7a..e8206513 100644 --- a/denis/utilities.py +++ b/denis/utilities.py @@ -47,7 +47,7 @@ def configure_repo(repo): def update_tags(assignment, component): grd_tbl = mailman.db.Gradeable - subs = (grd_tbl.select() + gbls = (grd_tbl.select() .order_by(-grd_tbl.timestamp) .where(grd_tbl.assignment == assignment) .where(grd_tbl.component == component)) @@ -67,12 +67,12 @@ def update_tags(assignment, component): print('Potential issue? Attempted to create duplicate tag ' f'{new_tag_name}') continue - user_sub = subs.where(grd_tbl.user == user.username).first() - if not user_sub or (id := user_sub.submission_id) not in repo.tags: + user_gbl = gbls.where(grd_tbl.user == user.username).first() + if not user_gbl or (id := user_gbl.submission_id) not in repo.tags: msg = 'No gradeable submission' to_promote = repo.tags['EMPTY'] else: - msg = user_sub.status + msg = user_gbl.auto_feedback to_promote = repo.tags[id] repo.create_tag(new_tag_name, ref=to_promote.commit, message=msg) @@ -90,7 +90,7 @@ def check_corrupt_or_missing(repo, tag, username_to_subs): msg += '\n' msg += '------------------------------' msg += '\n\n' - if not gradable or gradable.status[-1] == '!': + if not gradable or gradable.auto_feedback[-1] == '!': repo.git.execute(['git', 'notes', '--ref=grade', 'add', tag, '-m', '0']) if not gradable: msg += 'automatic 0 due to missing submission!' diff --git a/mailman/db.py b/mailman/db.py index 4b48ace5..978b351e 100755 --- a/mailman/db.py +++ b/mailman/db.py @@ -27,7 +27,7 @@ class Gradeable(BaseModel): user = peewee.TextField() assignment = peewee.TextField() component = peewee.TextField() - status = peewee.TextField(null=True) + auto_feedback = peewee.TextField(null=True) if __name__ == '__main__': diff --git a/mailman/inspector.py b/mailman/inspector.py index 95dce1a1..69da6fe2 100755 --- a/mailman/inspector.py +++ b/mailman/inspector.py @@ -78,7 +78,7 @@ def gradables(assignment, username, component): for gbl in query: print(gbl.submission_id, datetime.fromtimestamp(gbl.timestamp).astimezone().isoformat(), - gbl.assignment, gbl.user, gbl.component, gbl.status) + gbl.assignment, gbl.user, gbl.component, gbl.auto_feedback) def missing(assignment): diff --git a/mailman/patchset.py b/mailman/patchset.py index 44a3854f..01d41d36 100644 --- a/mailman/patchset.py +++ b/mailman/patchset.py @@ -88,20 +88,20 @@ def check(cover_letter, patches, submission_id): with repo.config_writer() as config: config.set_value('user', 'name', 'mailman') config.set_value('user', 'email', 'mailman@mailman') - status = do_check(repo, cover_letter, patches) - if status[-1] == '!': + auto_feedback = do_check(repo, cover_letter, patches) + if auto_feedback[-1] == '!': for patch in patches: patch_abspath = str(maildir / patch.msg_id) repo.git.execute(['git', 'commit', '--allow-empty', '-F', patch_abspath]) - tag_and_push(repo, submission_id, msg=status) - return status + tag_and_push(repo, submission_id, msg=auto_feedback) + return auto_feedback def apply_peer_review(email, submission_id, review_id): args = [*git_am_args, '--empty=keep'] patch_abspath = str(maildir / email.msg_id) - status = 'sucessfully stored peer review' + auto_feedback = 'sucessfully stored peer review' with tempfile.TemporaryDirectory() as repo_path: try: @@ -116,6 +116,6 @@ def apply_peer_review(email, submission_id, review_id): tag_and_push(repo, submission_id) except git.GitCommandError as e: print(e, file=sys.stderr) - status = 'failed to apply peer review' + auto_feedback = 'failed to apply peer review' - return status + return auto_feedback diff --git a/mailman/submit.py b/mailman/submit.py index c7f69f3b..23122563 100755 --- a/mailman/submit.py +++ b/mailman/submit.py @@ -65,7 +65,7 @@ def set_status(status): gr_db = db.Gradeable if asn := asn_db.get_or_none(asn_db.name == emails[0].rcpt): cover_letter, *patches = emails - status = patchset.check(cover_letter, patches, logfile) + auto_feedback = patchset.check(cover_letter, patches, logfile) if len(emails) < 2: return set_status('missing patches') typ = ('initial' if timestamp < asn.initial_due_date @@ -73,11 +73,11 @@ def set_status(status): if not typ: return set_status(f'{asn.name} past due') gr_db.create(submission_id=logfile, timestamp=timestamp, user=user, - assignment=asn.name, component=typ, status=status) + assignment=asn.name, component=typ, auto_feedback=auto_feedback) return set_status(f'{asn.name}: {typ}') if reply_id: - status = patchset.apply_peer_review(emails[0], logfile, reply_id) + auto_feedback = patchset.apply_peer_review(emails[0], logfile, reply_id) if not (orig := gr_db.get_or_none(gr_db.submission_id == reply_id)): return set_status('not a reply to a submission') asn_name = orig.assignment @@ -100,7 +100,7 @@ def set_status(status): return set_status('reviewed wrong submission') gr_db.create(submission_id=logfile, timestamp=timestamp, user=user, assignment=asn_name, component=typ, - status=status) + auto_feedback=auto_feedback) return set_status(f'{asn_name}: {typ}') return set_status('Not a recognized recipient') diff --git a/orbit/radius.py b/orbit/radius.py index 6ca6a6fb..dc3ed7d8 100644 --- a/orbit/radius.py +++ b/orbit/radius.py @@ -463,9 +463,9 @@ def get_automated_feedback(self, attr): due_date = int(self.assignment.final_due_date) if due_date < int(datetime.now().timestamp()): - return gbl.status + return gbl.auto_feedback - match gbl.status[-1]: + match gbl.auto_feedback[-1]: case '.': return 'Submission accepted' case '?':