예제 #1
0
    def test_each_trip_counted_once(self):
        """ Multiple trip leaders declaring a participant a flake is no worse than 1. """
        flaked = {'participant': self.participant, 'showed_up': False}
        for trip in self.three_trips:
            for _ in range(3):
                FeedbackFactory.create(trip=trip, **flaked)

        self.assertEqual(self.ranker.number_ws_trips(self.participant),
                         rank.TripCounts(attended=0, flaked=3, total=3))
예제 #2
0
    def test_each_trip_counted_once(self):
        """ Multiple trip leaders declaring a participant a flake is no worse than 1. """
        flaked = {'participant': self.participant, 'showed_up': False}
        for trip in self.three_trips:
            for _ in range(3):
                FeedbackFactory.create(trip=trip, **flaked)

        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=3, total=3),
        )
예제 #3
0
    def test_missed_each_trip(self):
        """ Missing multiple trips gives you a very poor score.  """
        # (Each SignUp object was deleted by trip leaders to indicate that the
        # participant never actually went on the trip)
        for trip in self.three_trips:
            FeedbackFactory.create(participant=self.participant,
                                   trip=trip,
                                   showed_up=False,
                                   comments="No show")

        self.assertEqual(self.ranker.number_ws_trips(self.participant),
                         rank.TripCounts(attended=0, flaked=3, total=3))
        self.assertEqual(15, self.ranker.flake_factor(self.participant))
예제 #4
0
    def test_perfect_attendance(self):
        """ Participants who've showed up for every trip score well.  """
        # (The only trips considered are past trips from the current Winter School)
        par_on_trip = {'participant': self.participant, 'on_trip': True}
        for trip in self.three_trips:
            models.SignUp.objects.create(trip=trip, **par_on_trip).save()

        # Count trips they attended, but for which they received no feedback
        self.assertEqual(-6, self.ranker.flake_factor(self.participant))

        # When explicitly noted as having attended, they receive the same score
        for trip in self.three_trips:
            FeedbackFactory.create(participant=self.participant,
                                   trip=trip,
                                   showed_up=True)
        self.assertEqual(-6, self.ranker.flake_factor(self.participant))
예제 #5
0
    def test_only_trips_attended_counted(self):
        """ Signing up for a trip (but not being placed) is not counted. """
        one, two, three = self.three_trips
        SignUpFactory.create(participant=self.participant, trip=one)
        SignUpFactory.create(participant=self.participant,
                             trip=two,
                             on_trip=True)

        FeedbackFactory.create(trip=three,
                               participant=self.participant,
                               showed_up=False)

        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=1, flaked=1, total=2),
        )
예제 #6
0
    def test_perfect_attendance(self):
        """ Participants who've showed up for every trip score well.  """
        # (The only trips considered are past trips from the current Winter School)
        par_on_trip = {'participant': self.participant, 'on_trip': True}
        for trip in self.three_trips:
            models.SignUp.objects.create(trip=trip, **par_on_trip).save()

        # Count trips they attended, but for which they received no feedback
        self.assertEqual(-6, self.ranker.flake_factor(self.participant))

        # When explicitly noted as having attended, they receive the same score
        for trip in self.three_trips:
            FeedbackFactory.create(
                participant=self.participant, trip=trip, showed_up=True
            )
        self.assertEqual(-6, self.ranker.flake_factor(self.participant))
예제 #7
0
    def test_missed_each_trip(self):
        """ Missing multiple trips gives you a very poor score.  """
        # (Each SignUp object was deleted by trip leaders to indicate that the
        # participant never actually went on the trip)
        for trip in self.three_trips:
            FeedbackFactory.create(
                participant=self.participant,
                trip=trip,
                showed_up=False,
                comments="No show",
            )

        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=3, total=3),
        )
        self.assertEqual(15, self.ranker.flake_factor(self.participant))
예제 #8
0
    def test_leader_disagreement(self):
        """ If only one leader reports them as flaking, that's a flake. """
        subject = {
            'participant': self.participant,
            'trip': self.three_trips[0]
        }

        models.SignUp(on_trip=True, **subject).save()

        # One leader says the participant didn't show
        FeedbackFactory.create(showed_up=False, comments="No show", **subject)

        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=1, total=1),
        )
        self.assertEqual(5, self.ranker.flake_factor(self.participant))

        # Co-leaders didn't note person a flake (most likely, didn't know how)
        FeedbackFactory.create(showed_up=True, **subject)
        FeedbackFactory.create(showed_up=True, **subject)

        # However, we still consider them to have flaked on the first trip
        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=1, total=1),
        )
        self.assertEqual(5, self.ranker.flake_factor(self.participant))
예제 #9
0
    def test_leader_disagreement(self):
        """ If only one leader reports them as flaking, that's a flake. """
        subject = {'participant': self.participant, 'trip': self.three_trips[0]}

        models.SignUp(on_trip=True, **subject).save()

        # One leader says the participant didn't show
        FeedbackFactory.create(showed_up=False, comments="No show", **subject)

        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=1, total=1),
        )
        self.assertEqual(5, self.ranker.flake_factor(self.participant))

        # Co-leaders didn't note person a flake (most likely, didn't know how)
        FeedbackFactory.create(showed_up=True, **subject)
        FeedbackFactory.create(showed_up=True, **subject)

        # However, we still consider them to have flaked on the first trip
        self.assertEqual(
            self.ranker.number_ws_trips(self.participant),
            rank.TripCounts(attended=0, flaked=1, total=1),
        )
        self.assertEqual(5, self.ranker.flake_factor(self.participant))