#63 Replacing vote expiration with vote accuarcy

This commit is contained in:
Leonhard Strohmidel
2022-09-20 09:56:23 +02:00
parent d213b51a59
commit 8597e53599
5 changed files with 57 additions and 16 deletions

View File

@@ -124,3 +124,31 @@ class PlaceTestCase(ModelTestCase):
self.model.__name__
)
)
def test_level_calculation(self):
place = self.place
explorer = place.submitted_by
PlaceVoting.objects.create(
submitted_by=explorer,
place=place,
vote=5,
expires_when=timezone.now()+self.delta
)
PlaceVoting.objects.create(
submitted_by=explorer,
place=place,
vote=2,
expires_when=timezone.now()+self.delta
)
PlaceVoting.objects.create(
submitted_by=explorer,
place=place,
vote=4,
expires_when=timezone.now()+self.delta
)
self.assertEqual(
4,
place.calculate_place_level()
)