def getStats(students, assign, filename, helpers): # gather students stats into an array studentDict = {} array = [] for student in students: safeFilename = common.makeFilenameSafe(filename) + "stats.json" path = helpers.getPreprocessedPath(student, assign.name, safeFilename) if path != None: json = io.readJSON(path) studentDict[student] = json array.append(json) return (studentDict, array)
def filterData(filename, assignment, args, helpers): jsonpath = helpers.getPostprocessedPath(assignment.name, filename) if jsonpath != None: json = io.readJSON(jsonpath) if json != None: # search the members for students from the given semester results = [] semester = args["semester"] for element in json: hasSemester = False for mem in element['members']: if mem['semester'] == semester: hasSemester = True if hasSemester == True: results.append(element) # write back to disk resultJSON = io.getJSONString(results, True) helpers.writeToPostprocessed(resultJSON, assignment.name, semester + "_" + filename)