예제 #1
0
파일: obfuscation.py 프로젝트: kmack3/Algae
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)
예제 #2
0
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)
예제 #3
0
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)
예제 #4
0
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)