forked from jce-il/TDD-Kata-FindAPerson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CrowdMap.py
30 lines (25 loc) · 977 Bytes
/
CrowdMap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from LocationService import LocationService
class CrowdMap():
def __init__(self, initPostList):
self.postList = initPostList
def getAllPostsFor(self, name):
return [post for post in self.postList if name in post]
def isLocationForName(self, name):
locationList = LocationService().getLocations()
postList = self.getAllPostsFor(name)
for post in postList:
for location in locationList:
if location in post:
return True
return False
def mapInconsistenciesExist(self, name):
locationList = LocationService().getLocations()
postList = self.getAllPostsFor(name)
appearnces = 0
for post in postList:
for location in locationList:
if location in post:
appearnces += 1
if appearnces > 1:
return True
return False