Commit 8bba1cdb authored by Alan Marchiori's avatar Alan Marchiori
Browse files

added feedback text file

parent 1579eb58
......@@ -64,7 +64,8 @@ def grade(lab, part, clone, dograde, regrade, user, skip, push, **kwargs):
debug('COURSENAME: ', coursename)
debug('COURSEPATH: ', coursepath)
who = "{}@{}".format(os.environ['USER'], platform.node())
#who = "{}@{}".format(os.environ['USER'], platform.node())
who = "{}@{}".format(os.environ['USER'], config.email_domain)
msg = "Grading {}".format(labname)
msg += " part {}".format(part) if part else ""
......@@ -290,6 +291,12 @@ def grade(lab, part, clone, dograde, regrade, user, skip, push, **kwargs):
hist['grade']['TOTAL']['total']))
hist['grade']['feedback'] = make_feedback_msg(rubric, hist['grade'])
feedfile = os.path.join(labpath, config.feedback_filename)
with open(feedfile, 'w') as f:
f.write(hist['grade']['feedback'])
f.write("\n")
hfile = hist.filename
# EXIT history context to force update on disk,
......@@ -298,25 +305,27 @@ def grade(lab, part, clone, dograde, regrade, user, skip, push, **kwargs):
# if not g.clean(cwd=labpath) or g.file_diff(cwd=labpath,
# files=[hfile]):
# hfile is set to none for db backends...
if hfile != None:
if push:
# only check if the history file has changes. we won't automatically
# push any other files!
if g.file_diff(cwd=labpath, files=[hfile]):
g.do_push(cwd = labpath,
addfiles = [hfile],
message = 'Lab {} graded by {}'.format(
lab,
who
))
if not g.clean(cwd=labpath):
echo(g.status(cwd=labpath))
if confirm("The working directory is not clean, do you want to add & push ALL changes?"):
g.do_push(cwd=labpath, addall=True,
# but we might have a feedback file to push
if push:
for pushfile in [hfile, feedfile]:
if pushfile != None:
# only check if the history file has changes. we won't automatically
# push any other files!
if g.file_diff(cwd=labpath, files=[pushfile]):
g.do_push(cwd = labpath,
addfiles = [pushfile],
message = 'Lab {} graded by {}'.format(
lab,
who
))
else:
warn("Not pushing to gitlab by your command.")
if not g.clean(cwd=labpath):
echo(g.status(cwd=labpath))
if confirm("The working directory is not clean, do you want to add & push ALL changes?"):
g.do_push(cwd=labpath, addall=True,
message = 'Lab {} graded by {}'.format(
lab,
who
))
else:
warn("Not pushing to gitlab by your command.")
......@@ -54,7 +54,7 @@ def ta_report(coursename, coursepath, labname, user, clone):
g = Git()
projects = gl.search_all_projects(coursename, owned=False)
width = min(120, shutil.get_terminal_size().columns)
who = "{}@{}".format(os.environ['USER'], platform.node())
who = "{}@{}".format(os.environ['USER'], config.email_domain)
# pull all repos first
if clone:
......@@ -181,12 +181,16 @@ def student_report(coursename, coursepath, labname, clone):
for rub in rubrics:
labname = rub['name']
labpath = os.path.join(coursepath, rub['path'])
if os.path.exists(labpath):
newline()
echo ("-"*max(10,width-5))
echo (labname)
feedbackfile = os.path.join(labpath, config.feedback_filename)
newline()
echo ("-"*max(10,width-5))
echo (labname)
if os.path.exists(feedbackfile):
with open(feedbackfile, 'r') as f:
for line in f:
echo(line.rstrip())
elif os.path.exists(labpath):
with History(location=labpath,save=False) as h:
if 'grade' in h:
r = h['grade']
......@@ -221,7 +225,7 @@ def student_report(coursename, coursepath, labname, clone):
else:
echo (f"Check your email for a message from {config.feedback_email_from}.")
#r[part]['who'].split("@")[0])
echo ("-"*max(10,width-5))
echo ("-"*max(10,width-5))
@click.command(short_help="Show the grade report.")
@click.option('--lab', type=int, required=False, default=None,
......
......@@ -10,6 +10,10 @@ smtp_server = "smtp.bucknell.edu"
# domain name to make an email address from git user id
email_domain = "bucknell.edu"
feedback_email_from = "labtool-no-reply@bucknell.edu"
# feeback filename for grades and comments
feedback_filename = "feedback.txt"
# where UserConfig is stored. (cannot be overridden)
local_conf = "~/.labtool/config.json"
......
......@@ -22,7 +22,7 @@ import os
import platform
import sys
__version__ = '2.0.0'
__version__ = '2.0.1'
__date__ = '2020-04-12T15:39:19.329244'
__user__ = 'cs206'
__host__ = 'linuxremote3.bucknell.edu'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment