def main(assignment):
    currentStudentFile = 'counters/student_counter.txt'
    student = readFirstLine(currentStudentFile)
    studentsFolder = assignment + '_Submissions_unzipped/' + student
    fileToReplace = studentsFolder + '/' + student + '.txt'
    print(fileToReplace)
    remove(fileToReplace)
    templateName = assignment + 'GradingTemplate_18S.txt'
    copy2(templateName, fileToReplace)
Exemplo n.º 2
0
def setup(assignment):
    currentStudentFile = 'counters/student_counter.txt'
    updateFileName = "counters/shouldUpdate.txt"
    setupFile(currentStudentFile)
    setupFile(updateFileName)
    studentsDir = assignment + '_Submissions_unzipped'
    studentToTest = getNextStudent(studentsDir, currentStudentFile, updateFileName)
    shouldUpdate = readFirstLine(updateFileName)
    return currentStudentFile, studentsDir, studentToTest, shouldUpdate
Exemplo n.º 3
0
def getNextStudent(studentsDir, currentStudentFile, lastStudentFile):
    currentStudent = readFirstLine(currentStudentFile)
    allStudents = getListOfStudents(studentsDir)
    if len(allStudents) == 0:
        return None
    if not currentStudent:
        return allStudents[0]
    getNext = False
    for student in allStudents:
        if getNext:
            return student
        getNext = currentStudent == student
    return None
Exemplo n.º 4
0
def main(assignment):
    outputFileName = 'counters/output.txt'
    updateFileName = 'counters/shouldUpdate.txt'
    currentStudentFile = 'counters/student_counter.txt'
    setupFile(outputFileName)
    start, end = findStartAndEndTestOutput(outputFileName, ':testStudentCode',
                                           'BUILD SUCCESSFUL')

    if start == -1 or end == -1:
        saveFirstLine(updateFileName, str(False))
        print('Did not compile or pass tests')
        return
    else:
        saveFirstLine(updateFileName, str(True))

    currentStudent = readFirstLine(currentStudentFile)
    sutdentTemplateFileName = createStudentTemplateFileName(
        currentStudent, assignment)
    testOutput = starEndFileToString(outputFileName, start, end)
    replaceStringsInFile(sutdentTemplateFileName, ['[PUT OUTPUT HERE]'],
                         [testOutput])