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
3 changes: 2 additions & 1 deletion denis/peer_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
tags1 = utilities.update_tags(assignment, 'review1')
tags2 = utilities.update_tags(assignment, 'review2')

utilities.run_automated_checks(tags1 + tags2, usernames_to_subs_review1 | usernames_to_subs_review2, peer=True)
utilities.run_automated_checks(tags1, usernames_to_subs_review1, peer=True)
utilities.run_automated_checks(tags2, usernames_to_subs_review2, peer=True)

print(f'completed {assignment} assignment processing for peer review submission deadline')
4 changes: 3 additions & 1 deletion denis/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ def check_subject_tag(repo, tag):
def run_automated_checks(tags, username_to_subs, peer=False):
with tempfile.TemporaryDirectory() as repo_path:
repo = git.Repo.clone_from(PULL_URL, repo_path)
# fetch from the pull URL: the CGI server behind the push URL drops
# the Content-Encoding header, so a gzipped fetch request fails there
repo.remotes.origin.fetch('refs/notes/*:refs/notes/*')

remote = repo.create_remote(REMOTE_NAME, PUSH_URL)
remote.fetch('refs/notes/*:refs/notes/*')
configure_repo(repo)

for tag in tags:
Expand Down
18 changes: 16 additions & 2 deletions orbit/hyperspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ def errx(msg):
exit(1)


def need(a, u=False, p=False):
def need(a, u=False, p=False, f=False):
needed = []
if u and a.username is None:
needed.append('username')
if p and a.password is None:
needed.append('password')
if f and a.fullname is None:
needed.append('fullname')
if needed:
errx(f"Need {' and '.join(needed)}. Bye.")

Expand Down Expand Up @@ -50,6 +52,15 @@ def do_change_password(args):
nou(args.username)


def do_change_fullname(args):
need(args, u=True, f=True)
query = (db.User
.update({db.User.fullname: args.fullname})
.where(db.User.username == args.username))
if query.execute() < 1:
nou(args.username)


def do_reset_password(args):
need(args, u=True)
query = (db.User
Expand Down Expand Up @@ -89,7 +100,7 @@ def do_newuser(args):
def do_roster(args):
print('Users:')
for u in db.User.select():
print(f'{u.username}, {u.pwdhash}, {u.student_id}')
print(f'{u.username}, {u.pwdhash}, {u.student_id}, {u.fullname}')


def do_list_sessions(args):
Expand Down Expand Up @@ -119,6 +130,9 @@ def hyperspace_main(raw_args):
actions.add_argument('-m', '--mutatepassword', action='store_const',
help='Change password for supplied username to supplied password',
dest='do', const=do_change_password)
actions.add_argument('-e', '--editfullname', action='store_const',
help='Change full name for supplied username to supplied full name',
dest='do', const=do_change_fullname)
actions.add_argument('-c', '--clearpassword', action='store_const',
help='clear password for supplied username so they cannot login',
dest='do', const=do_reset_password)
Expand Down
Loading