Beispiel #1
0
def ToggleActivityForcedStatus(stu: DataHandler.Student, period, index):
    if stu.choices[period][index].isForced == True:
        stu.choices[period][index].isForced = False
        stu.myButtons[period][index].configure(font="arial 9 normal")
        DataHandler.UpdateButtonColors()
        print("Student: " + stu.name + "  Period: " + str(period) +
              "  Activity: " + stu.choices[period][index].name +
              " is unforced")
    else:
        stu.choices[period][index].isForced = True
        stu.myButtons[period][index].configure(font="arial 9 bold")
        print("Student: " + stu.name + "  Period: " + str(period) +
              "  Activity: " + stu.choices[period][index].name + " is FORCED")

        DataHandler.AssignStudentToActivity(stu, period, index, True,
                                            "DUMMY NAME")
        DataHandler.UpdateActivityAssignmentsUI()
        DataHandler.CalculateAverages()

        n = 0
        for act in stu.choices[period]:
            if (act.isForced) and (n != index):
                ToggleActivityForcedStatus(stu, period, n)
            n += 1