|
@@ -249,7 +249,21 @@ def search(conn, locality_id):
|
|
|
|
|
|
|
|
page += 1
|
|
page += 1
|
|
|
|
|
|
|
|
- gone = set(known_prices.keys()).difference(seen_properties)
|
|
|
|
|
|
|
+ gone = {pid for pid, price in known_prices.items() if price != 'GONE'}.difference(seen_properties)
|
|
|
|
|
+
|
|
|
|
|
+ if gone:
|
|
|
|
|
+ stmt = 'insert into search_results (search_locality_id, time, property_id, price) VALUES'
|
|
|
|
|
+ params = []
|
|
|
|
|
+ for property_id in gone:
|
|
|
|
|
+ stmt += ' (?, ?, ?, ?),'
|
|
|
|
|
+ params.extend([
|
|
|
|
|
+ locality_id,
|
|
|
|
|
+ _now(),
|
|
|
|
|
+ property_id,
|
|
|
|
|
+ 'GONE',
|
|
|
|
|
+ ])
|
|
|
|
|
+
|
|
|
|
|
+ conn.execute(stmt[:-1], *params)
|
|
|
|
|
|
|
|
print('Search complete. %i records fetched; %i new records added; %i records modified; %i records marked as gone.' % (len(seen_properties), added, modified, len(gone)))
|
|
print('Search complete. %i records fetched; %i new records added; %i records modified; %i records marked as gone.' % (len(seen_properties), added, modified, len(gone)))
|
|
|
|
|
|