chore: Apply suggestions from code review

Co-authored-by: Prssanna Desai <prssud@gmail.com>
This commit is contained in:
Mathieu Brunot 2020-10-07 18:12:03 +02:00 committed by GitHub
parent a22347d806
commit ad313cf549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -41,7 +41,7 @@ def merge_location_features_in_one(coords):
'''Merging all features from location field.'''
geojson_dict = []
for element in coords:
geojson_loc = json.loads(element['location'])
geojson_loc = frappe.parse_json(element['location'])
for coord in geojson_loc['features']:
coord['properties']['name'] = element['name']
geojson_dict.append(coord.copy())

View file

@ -91,11 +91,10 @@ frappe.views.ListSidebar = class ListSidebar {
show_list_link = true;
}
if ((JSON.stringify(frappe.listview_settings) !== '{}' &&
frappe.listview_settings[this.list_view.doctype].get_coords_method) ||
(this.list_view.meta.fields.find(i => i.fieldname === "latitude") &&
this.list_view.meta.fields.find(i => i.fieldname === "longitude")) ||
(this.list_view.meta.fields.find(i => i.fieldname === 'location') && this.list_view.meta.fields.find(i => i.fieldtype === 'Geolocation'))) {
if (this.list_view.settings.get_coords_method ||
(this.list_view.meta.fields.find(i => i.fieldname === "latitude") &&
this.list_view.meta.fields.find(i => i.fieldname === "longitude")) ||
(this.list_view.meta.fields.find(i => i.fieldname === 'location' && i.fieldtype == 'Geolocation')))
this.sidebar.find('.list-link[data-view="Map"]').removeClass('hide');
show_list_link = true;
}