Skip to content
Snippets Groups Projects
Commit 57cf8d45 authored by tuhe's avatar tuhe
Browse files

Minor updates for grading in 02465

parent f0ea3c94
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,7 @@ def xlsx_to_dicts(xlsx_file,sheet=None, as_dict_list=False, columns=None):
return dd
def get_enrolled_students():
# s224202
paths = get_paths()
students = xlsx_to_dicts(paths['information.xlsx'], sheet='students')
students2 = {}
......
......@@ -119,6 +119,10 @@ def handle_projects(verbose=False, gather_main_xlsx_file=True, plagiarism_check=
print("> Done gathering main .xlsx file from instructor .xlsx files")
cache_update_dir(cache_base, cache_base, pattern="*.xlsx")
info = class_information()
id = 's225785'
pid = 1
print(info['students'][id]['reports'][pid])
zip1 = instructor_path + "/zip1.zip"
zip2 = instructor_path + "/zip2.zip"
......@@ -147,7 +151,7 @@ def handle_projects(verbose=False, gather_main_xlsx_file=True, plagiarism_check=
else:
print("When available, please move downloaded copy of all reports from campusnet to destination:")
print(zf)
info['students']['s225785']['reports'][1]
mkboxplots(info['students'],paths)
if cache_changed_xlsx_files:
......@@ -666,13 +670,50 @@ def gather_instructor_sheets(info):
ts.save(out)
ts.close()
print("Collected xlsx instructor files. Using xlwings to load main worksheet, evaluate and save it")
# 024
import xlwings
try:
# def main() -> None:
# info = class_information()
# id = 's225785'
# pid = 1
# print(info['students'][id]['reports'][pid])
# shutil.run( )
# from ooodev.loader.lo import Lo
# from ooodev.office.calc import Calc
#
# # fnm = sys.argv[1:] # get file from first args
# fnm = out
#
# loader = Lo.load_office(Lo.ConnectSocket(headless=True))
# doc = Lo.open_doc(fnm=fnm, loader=loader)
#
# # use the Office API to manipulate doc...
# Lo.save_doc(doc, out) # save as a Word file
# Lo.close_doc(doc)
# Lo.close_office()
book = xw.Book(out)
book.save(out)
book.close()
except xlwings.XlwingsError as e:
print("No xlsxwings installed. Sheets are not correctly evaluated.")
# import shutil
import subprocess
cmd = f'cd {os.path.basename(out)} && libreoffice --calc --headless --invisible --convert-to xlsx --outdir ../ {os.path.basename(out)}'
output = subprocess.run(cmd, capture_output=True, shell=True)
time.sleep(3)
od = os.path.dirname(os.path.dirname(out)) + "/" + os.path.basename(out)
while not os.path.isfile(od):
time.sleep(1)
print("Waiting for file", od)
shutil.move(od, out)
print(e)
......
......@@ -287,7 +287,12 @@ def populate_student_report_results(students, verbose=False):
# for i in range(2, wb.worksheets[repn].max_column + 1):
# print(i, wb.worksheets[repn].max_column)
# s = pd.read_excel(out, sheet_name=1)
cp = parse_column_numpy(sheet[:,i], report_number=repn, column=i)
if repn == 1 and 1 > 2:
# info['students']['s225785']['reports'][1]
pass
# cp = parse_column(wb.worksheets[repn], report_number=repn, column=i)
if not cp['student_ids']:
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment