Пример #1
0
def get_next_member(workday, myteam):
    valid = False
    notvalid = []

    # Retreive next of list and reshuffle list
    while (valid is False):
        if len(myteam) < 1:
            print("No availability")
            return
        try:
            member = myteam.popleft()
        except IndexError:
            print("Got Error")
        # Check if member is available
        if not team.check_availability(workday, member):
            notvalid.append(member)
        else:
            member.count += 1
            myteam.append(member)
            valid = True

    for m in notvalid:
        myteam.appendleft(m)

    return member
Пример #2
0
    def test_check_availability(self):
        t = team.get_team(self.testfile)

        for member in t:
            if member.name == 'alice':
                result = team.check_availability(self.workdate, member)
                self.assertFalse(result)
            elif member.name == 'bob':
                result = team.check_availability(self.workdate, member)
                self.assertFalse(result)
            elif member.name == 'chris':
                result = team.check_availability(self.workdate, member)
                self.assertFalse(result)
            elif member.name == 'debby':
                result = team.check_availability(self.workdate, member)
                self.assertTrue(result)
            elif member.name == 'dude':
                result = team.check_availability(self.workdate, member)
                self.assertTrue(result)