Merge branch 'master' of https://github.com/Hatrix42/Flatisfy into Hatrix42-master
This commit is contained in:
commit
9c55904f59
@ -34,6 +34,7 @@ DEFAULT_CONFIG = {
|
|||||||
"cost": (None, None), # (min, max) in currency unit
|
"cost": (None, None), # (min, max) in currency unit
|
||||||
"rooms": (None, None), # (min, max)
|
"rooms": (None, None), # (min, max)
|
||||||
"bedrooms": (None, None), # (min, max)
|
"bedrooms": (None, None), # (min, max)
|
||||||
|
"minimum_pictures": None,
|
||||||
"time_to": {} # Dict mapping names to {"gps": [lat, lng],
|
"time_to": {} # Dict mapping names to {"gps": [lat, lng],
|
||||||
# "time": (min, max) }
|
# "time": (min, max) }
|
||||||
# Time is in seconds
|
# Time is in seconds
|
||||||
@ -138,6 +139,10 @@ def validate_config(config, check_with_data):
|
|||||||
assert isinstance(constraint["type"], str)
|
assert isinstance(constraint["type"], str)
|
||||||
assert constraint["type"].upper() in ["RENT", "SALE", "SHARING"]
|
assert constraint["type"].upper() in ["RENT", "SALE", "SHARING"]
|
||||||
|
|
||||||
|
assert "minimum_pictures" in constraint
|
||||||
|
assert isinstance(constraint["minimum_pictures"], int)
|
||||||
|
assert constraint["minimum_pictures"] >= 0
|
||||||
|
|
||||||
assert "house_types" in constraint
|
assert "house_types" in constraint
|
||||||
assert constraint["house_types"]
|
assert constraint["house_types"]
|
||||||
for house_type in constraint["house_types"]:
|
for house_type in constraint["house_types"]:
|
||||||
|
@ -67,6 +67,12 @@ def refine_with_housing_criteria(flats_list, constraint):
|
|||||||
field.capitalize(), flat["id"])
|
field.capitalize(), flat["id"])
|
||||||
is_ok[i] = is_ok[i] and is_within_interval
|
is_ok[i] = is_ok[i] and is_within_interval
|
||||||
|
|
||||||
|
# Check number of pictures
|
||||||
|
print(constraint['minimum_pictures'], len(flat['photos']))
|
||||||
|
if not (constraint['minimum_pictures'] <= len(flat['photos'])):
|
||||||
|
is_ok[i] = False
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
[
|
[
|
||||||
flat
|
flat
|
||||||
|
Loading…
Reference in New Issue
Block a user