Commit 151eab83 authored by Alan Marchiori's avatar Alan Marchiori
Browse files

fixed report using wrong db path

parent 80da6485
......@@ -141,7 +141,7 @@ def do_cmd(ctx, cmdstr, projects, proj_list, lab_list, part_list):
def update_student_list_with_grades(coursename, coursepath, projects, proj_list, labstr):
"""
Query the db for grades and update student list accordingly.
This is run from a backround thread becuase it could be slow.
This is run from a backround thread because it could be slow.
"""
# proj_list = RadioList(values=[(None, 'All')] + [
......
......@@ -91,16 +91,24 @@ def ta_report(coursename, coursepath, labname, user, clone):
if user and student != user:
continue
for rub in rubrics:
for labstr, rub in zip(labnames, rubrics):
labname = rub['name']
labpath = os.path.join(coursepath, student, rub['path'])
# TODO: FIX dbpath to always use RUBRIC name, ie labname
# IN grade and most other places it uses labstr = "lab{:02}".format(lab)
# where lab is the lab NUMBER!
#dbpath = '{}/{}/{}'.format(coursename, student, labname)
dbpath = '{}/{}/{}'.format(coursename, student, labstr)
#print("loading ", dbpath)
with History(location=labpath, save=False,
dbpath='{}/{}/{}'.format(coursename, student, labname)) as h:
dbpath=dbpath) as h:
if 'grade' in h and 'feedback' in h['grade']:
print("-"*width)
print("{} ({}): {}".format(student,p['owner']['name'], labname))
print(h['grade']['feedback'])
##
print("="*width)
## print CSV style summary report
......@@ -122,12 +130,12 @@ def ta_report(coursename, coursepath, labname, user, clone):
report_parts = [student.ljust(8)]
for rub in rubrics:
for labstr, rub in zip(labnames, rubrics):
labname = rub['name']
labpath = os.path.join(coursepath, student, rub['path'])
with History(location=labpath, save=False,
dbpath='{}/{}/{}'.format(coursename, student, labname)) as h:
dbpath='{}/{}/{}'.format(coursename, student, labstr)) as h:
if 'grade' in h:
r = h['grade']
......@@ -161,12 +169,19 @@ def ta_report(coursename, coursepath, labname, user, clone):
report_parts = ["STATS".ljust(8)]
for rub in rubrics:
labname = rub['name']
if len(c_tot[labname]) > 0:
if len(c_tot[labname]) > 1:
report_parts += [
"{:5.1f}, {:5.1f}".format(
statistics.mean(c_tot[labname]),
statistics.stdev(c_tot[labname])),
]
elif len(c_tot[labname]) > 0:
#print ('stats', labname, c_tot[labname])
report_parts += [
"{:5.1f}, {:5.1f}".format(
c_tot[labname][0],
c_tot[labname][0]),
]
else:
report_parts += [' ', ' ']
print(", ".join(report_parts))
......@@ -242,8 +257,8 @@ def student_report(coursename, coursepath, labname, clone):
help='The lab (number) to show the report for.')
@click.option("--user", default=None, show_default = True,
help='Set to only report on a single user (by git username).')
@click.option("--clone/--no-clone", default=True,
help='Clone repo before showing report?\t[default: True]')
@click.option("--clone/--no-clone", default=False,
help='Clone repo before showing report?\t[default: False]')
def report(lab, user, clone, **kwargs):
"""
print grade report, if in ta context all users, for students all lab scores
......
......@@ -119,8 +119,9 @@ class History(dict):
exit(213)
self.update(df)
# or just insert an empty document
r = self.mc.insert_one(self)
self['_id'] = r.inserted_id
if self.save:
r = self.mc.insert_one(self)
self['_id'] = r.inserted_id
else:
if os.path.exists(self.pathfile):
try:
......
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