From af8d864c38bcf67c07dc887de0b947c6fc458341 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Thu, 14 Jan 2021 17:46:17 +0100 Subject: [PATCH 01/43] Add default map center to avoid error on launch --- flatisfy/web/js_src/components/flatsmap.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flatisfy/web/js_src/components/flatsmap.vue b/flatisfy/web/js_src/components/flatsmap.vue index 5115ca6..08d4d93 100644 --- a/flatisfy/web/js_src/components/flatsmap.vue +++ b/flatisfy/web/js_src/components/flatsmap.vue @@ -46,9 +46,9 @@ export default { fillColor: '#e4ce7f', fillOpacity: 1 }, - center: null, + center: [46.449, 2.210], zoom: { - defaultZoom: 13, + defaultZoom: 6, minZoom: 5, maxZoom: 17 }, From 31f08cb36b677e1834b16abb5421e48041d3d371 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Thu, 14 Jan 2021 17:47:23 +0100 Subject: [PATCH 02/43] Add ziparound dev dep --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b6b754..cf23cfb 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "vue-html-loader": "^1.2.4", "vue-loader": "^11.3.4", "vue-template-compiler": "^2.2.6", - "webpack": "^2.3.3" + "webpack": "^2.3.3", + "ziparound": "https://github.com/guix77/ziparound" } } From 0da04a4b6e8229522d4bc2b25e6d33213d21a95c Mon Sep 17 00:00:00 2001 From: Gautier P Date: Sun, 7 Feb 2021 11:43:49 +0100 Subject: [PATCH 03/43] Remove obsolete weboob modules repo --- docker/Dockerfile | 2 +- docker/docker-compose.yml | 1 + requirements.txt | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 601f4bd..d51335c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get install -y nodejs # Install weboob's code itself. -RUN git clone --depth 1 https://git.weboob.org/weboob/devel /home/user/weboob \ +RUN git clone --depth 1 https://git.weboob.org/weboob/weboob /home/user/weboob \ && cd /home/user/weboob \ && pip install . diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b038337..6ddafdb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,3 +9,4 @@ services: - ./data:/flatisfy ports: - "8080:8080" + working_dir: /home/user/app diff --git a/requirements.txt b/requirements.txt index da794c0..374afb9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,5 +15,4 @@ titlecase unidecode vobject whoosh -https://git.weboob.org/weboob/devel/repository/archive.zip?ref=master -https://git.weboob.org/weboob/modules/repository/archive.zip?ref=master +https://git.weboob.org/weboob/weboob/repository/archive.zip?ref=master From b19459b97f06105bd2741fa9a7c94b88650f3911 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Fri, 15 Jan 2021 16:09:45 +0100 Subject: [PATCH 04/43] Try fallback to address if location is missing --- flatisfy/filters/metadata.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flatisfy/filters/metadata.py b/flatisfy/filters/metadata.py index a51798b..1b26cd8 100644 --- a/flatisfy/filters/metadata.py +++ b/flatisfy/filters/metadata.py @@ -147,14 +147,19 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000): for flat in flats_list: location = flat.get("location", None) + if not location: + addr = flat.get("address", None) + if addr: + location = addr['full_address'] if not location: # Skip everything if empty location LOGGER.info( ( "No location field for flat %s, skipping postal " - "code lookup." + "code lookup. (%s)" ), - flat["id"] + flat["id"], + flat["address"] ) continue From 9698a889ad80b556c4f9d7008fb2502b371e2403 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Fri, 15 Jan 2021 16:10:23 +0100 Subject: [PATCH 05/43] Add marker cluster and update leaflet --- flatisfy/web/js_src/components/flatsmap.vue | 42 ++++++++++++--------- flatisfy/web/js_src/store/getters.js | 22 +++++------ flatisfy/web/js_src/views/home.vue | 1 - package.json | 4 +- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/flatisfy/web/js_src/components/flatsmap.vue b/flatisfy/web/js_src/components/flatsmap.vue index 08d4d93..99be71a 100644 --- a/flatisfy/web/js_src/components/flatsmap.vue +++ b/flatisfy/web/js_src/components/flatsmap.vue @@ -2,16 +2,20 @@
- - + + + + + + @@ -31,10 +35,13 @@ L.Icon.Default.mergeOptions({ }) import 'leaflet/dist/leaflet.css' +import 'leaflet.markercluster/dist/MarkerCluster.css' +import 'leaflet.markercluster/dist/MarkerCluster.Default.css' require('leaflet.icon.glyph') -import Vue2Leaflet from 'vue2-leaflet' +import { LMap, LTileLayer, LMarker, LTooltip, LPopup, LGeoJSON } from 'vue2-leaflet' +import Vue2LeafletMarkerCluster from 'vue2-leaflet-markercluster' export default { data () { @@ -67,12 +74,13 @@ export default { }, components: { - 'v-map': Vue2Leaflet.Map, - 'v-tilelayer': Vue2Leaflet.TileLayer, - 'v-marker': Vue2Leaflet.Marker, - 'v-tooltip': Vue2Leaflet.Tooltip, - 'v-popup': Vue2Leaflet.Popup, - 'v-geojson-layer': Vue2Leaflet.GeoJSON + 'v-map': LMap, + 'v-tilelayer': LTileLayer, + 'v-marker': LMarker, + 'v-marker-cluster': Vue2LeafletMarkerCluster, + 'v-tooltip': LTooltip, + 'v-popup': LPopup, + 'v-geojson-layer': LGeoJSON }, computed: { diff --git a/flatisfy/web/js_src/store/getters.js b/flatisfy/web/js_src/store/getters.js index 6610e33..8814c7a 100644 --- a/flatisfy/web/js_src/store/getters.js +++ b/flatisfy/web/js_src/store/getters.js @@ -33,20 +33,20 @@ export default { const gps = findFlatGPS(flat) if (gps) { - const previousMarkerIndex = markers.findIndex( + const previousMarker = markers.find( marker => marker.gps[0] === gps[0] && marker.gps[1] === gps[1] ) - - const href = router.resolve({ name: 'details', params: { id: flat.id }}).href - if (previousMarkerIndex !== -1) { - markers[previousMarkerIndex].content += '
' + flat.title + '' - } else { - markers.push({ - 'title': '', - 'content': '' + flat.title + '', - 'gps': gps - }) + if (previousMarker) { + // randomize position a bit + // gps[0] += (Math.random() - 0.5) / 500 + // gps[1] += (Math.random() - 0.5) / 500 } + const href = router.resolve({ name: 'details', params: { id: flat.id }}).href + markers.push({ + 'title': '', + 'content': '' + flat.title + '', + 'gps': gps + }) } } }) diff --git a/flatisfy/web/js_src/views/home.vue b/flatisfy/web/js_src/views/home.vue index 076166a..2b2c874 100644 --- a/flatisfy/web/js_src/views/home.vue +++ b/flatisfy/web/js_src/views/home.vue @@ -1,7 +1,6 @@