Merge branch 'split-different-stations' into 'master'

Split stations on comma

See merge request phyks/Flatisfy!32
This commit is contained in:
Phyks 2018-10-15 08:37:29 +02:00
commit 35c902d3d3
1 changed files with 18 additions and 6 deletions

View File

@ -289,12 +289,24 @@ def guess_stations(flats_list, constraint, config):
) )
continue continue
matched_stations = fuzzy_match( # Weboob modules can return several stations in a comma-separated list.
flat_station, flat_stations = flat_station.split(',')
[x.name for x in opendata["stations"]], # But some stations containing a comma exist, so let's add the initial
limit=10, # value to the list of stations to check if there was one.
threshold=50 if len(flat_stations) > 1:
) flat_stations.append(flat_station)
matched_stations = []
for tentative_station in flat_stations:
matched_stations += fuzzy_match(
tentative_station,
[x.name for x in opendata["stations"]],
limit=10,
threshold=50
)
# Keep only one occurrence of each station
matched_stations = list(set(matched_stations))
# Filter out the stations that are obviously too far and not well # Filter out the stations that are obviously too far and not well
# guessed # guessed