Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions denis/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)

Expand All @@ -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!'
Expand Down
2 changes: 1 addition & 1 deletion mailman/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
2 changes: 1 addition & 1 deletion mailman/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions mailman/patchset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
8 changes: 4 additions & 4 deletions mailman/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ 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
else 'final' if timestamp < asn.final_due_date else None)
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
Expand All @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions orbit/radius.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '?':
Expand Down