Phyks (Lucas Verney) 7 months ago
parent
commit
3b9cf0917a
1 changed files with 29 additions and 29 deletions
  1. 29
    29
      flatisfy/web/js_src/store/getters.js

+ 29
- 29
flatisfy/web/js_src/store/getters.js View File

@@ -9,80 +9,80 @@ export default {
9 9
     isLoading: (state) => state.loading > 0,
10 10
 
11 11
     inseeCodesFlatsBuckets: (state, getters) => (filter) => {
12
-        const buckets = {};
12
+        const buckets = {}
13 13
 
14 14
         state.flats.forEach((flat) => {
15 15
             if (!filter || filter(flat)) {
16
-                const insee = flat.flatisfy_postal_code.insee_code;
16
+                const insee = flat.flatisfy_postal_code.insee_code
17 17
                 if (!buckets[insee]) {
18 18
                     buckets[insee] = {
19 19
                         name: flat.flatisfy_postal_code.name,
20
-                        flats: [],
21
-                    };
20
+                        flats: []
21
+                    }
22 22
                 }
23
-                buckets[insee].flats.push(flat);
23
+                buckets[insee].flats.push(flat)
24 24
             }
25
-        });
25
+        })
26 26
 
27
-        return buckets;
27
+        return buckets
28 28
     },
29 29
 
30 30
     flatsMarkers: (state, getters) => (router, filter) => {
31
-        const markers = [];
31
+        const markers = []
32 32
         state.flats.forEach((flat) => {
33 33
             if (filter && filter(flat)) {
34
-                const gps = findFlatGPS(flat);
34
+                const gps = findFlatGPS(flat)
35 35
 
36 36
                 if (gps) {
37 37
                     const previousMarker = markers.find(
38 38
                         (marker) =>
39 39
                             marker.gps[0] === gps[0] && marker.gps[1] === gps[1]
40
-                    );
40
+                    )
41 41
                     if (previousMarker) {
42 42
                         // randomize position a bit
43 43
                         // gps[0] += (Math.random() - 0.5) / 500
44 44
                         // gps[1] += (Math.random() - 0.5) / 500
45 45
                     }
46 46
                     const href = router.resolve({
47
-                        name: "details",
48
-                        params: { id: flat.id },
49
-                    }).href;
47
+                        name: 'details',
48
+                        params: { id: flat.id }
49
+                    }).href
50 50
                     const cost = flat.cost
51 51
                         ? costFilter(flat.cost, flat.currency)
52
-                        : "";
52
+                        : ''
53 53
                     markers.push({
54
-                        title: "",
54
+                        title: '',
55 55
                         content:
56 56
                             '<a href="' +
57 57
                             href +
58 58
                             '">' +
59 59
                             flat.title +
60
-                            "</a>" +
60
+                            '</a>' +
61 61
                             cost,
62 62
                         gps: gps,
63
-                        flatId: flat.id,
64
-                    });
63
+                        flatId: flat.id
64
+                    })
65 65
                 }
66 66
             }
67
-        });
67
+        })
68 68
 
69
-        return markers;
69
+        return markers
70 70
     },
71 71
 
72 72
     allTimeToPlaces: (state) => {
73
-        const places = {};
73
+        const places = {}
74 74
         Object.keys(state.timeToPlaces).forEach((constraint) => {
75
-            const constraintTimeToPlaces = state.timeToPlaces[constraint];
75
+            const constraintTimeToPlaces = state.timeToPlaces[constraint]
76 76
             Object.keys(constraintTimeToPlaces).forEach((name) => {
77
-                places[name] = constraintTimeToPlaces[name];
78
-            });
79
-        });
80
-        return places;
77
+                places[name] = constraintTimeToPlaces[name]
78
+            })
79
+        })
80
+        return places
81 81
     },
82 82
 
83 83
     timeToPlaces: (state, getters) => (constraintName) => {
84
-        return state.timeToPlaces[constraintName];
84
+        return state.timeToPlaces[constraintName]
85 85
     },
86 86
 
87
-    metadata: (state) => state.metadata,
88
-};
87
+    metadata: (state) => state.metadata
88
+}