Bug: geo_location data not saved correctly in user custom field

With the latest CWP and Locations plugins, on Tests-Passed,

When these occur:

  1. a Locations Field is configured
  2. this presented in a simple Wizard
  3. in Update Profile there is a Custom mapping like this:

The .json data in the geo_location field unfortunately does not result in the location being presented in the user profile, card, or summary. See below for examples:

When data is inputed via /my/preferences/profile:

{"lat":"-45.8740984","lon":"170.5035755","address":"Dunedin, Dunedin City, Otago, 9016, New Zealand","countrycode":"nz","city":"Dunedin","state":"Otago","country":"New Zealand","postalcode":"9016","boundingbox":["-46.0340984","-45.7140984","170.3435755","170.6635755"],"type":"city"}

This shows in the map, on the user cards / profile, and in /my/preferences/profile nicely

When the data gets there via the Wizard Custom mapping as above

{"city":"Dunedin","geo_location":{"lat":"-45.8740984","lon":"170.5035755","address":"Dunedin, Dunedin City, Otago, 9016, New Zealand","countrycode":"nz","city":"Dunedin","state":"Otago","country":"New Zealand","postalcode":"9016","boundingbox":["-46.0340984","-45.7140984","170.3435755","170.6635755"],"type":"city","selected":"true","zoomTo":"true"}}

This doesnā€™t show up at all on the map, shows as a ā€˜blankā€™ in the user cards / profile, and appears blank in /my/preferences/profile:

image

image

Basically, it seems to include the input sub-field in an unhelpful way, with geo_location nested one level deeper.

Perhaps this is only designed for Topics, not users - and this is a feature request.

2 Likes

Are you aware if this working better on a prior version of CW? ie is this a regression or was it possibly always this way?

The data extracts are really useful, thanks.

1 Like

Iā€™m not sure sorry; Iā€™ve tried to get this working in the past, but thought I failed due to my inadequate config work.

This is the first time Iā€™ve really investigated it.

1 Like

Rob, any idea when this might get addressed?

I need to get a user location updating wizard up and going soon.

Sorry I donā€™t have time to look at this for at least two weeks

1 Like

Looking at Locations atm, will try to sweep this up as part of that.

1 Like

@NathanK you are right in that the User Custom Field appears to be just ā€œGeolocationā€, e.g.:

 #<UserCustomField:0x00007ff1703f5020
  id: 9893,
  user_id: 3093,
  name: "geo_location",
  value:
   "{\"lat\":\"53.4071991\",\"lon\":\"-2.99168\",\"address\":\"Liverpool, Liverpool City Region, England, United Kingdom\",\"countrycode\":\"gb\",\"city\":\"Liverpool\",\"state\":\"England\",\"country\":\"United Kingdom\",\"postalcode\":\"\",\"boundingbox\":[\"53.3115427\",\"53.4749885\",\"-3.0191726\",\"-2.8180003\"],\"type\":\"administrative\"}"

Whereas the Topic location data seem to duplicate ā€¦ and has a wrapper called ā€˜locationā€™.

#<TopicCustomField:0x00007ff170e11888
  id: 2273,
  topic_id: 20622,
  name: "location",
  value:
   "{\"street\":\"liver building\",\"countrycode\":\"gb\",\"geo_location\":{\"lat\":53.40583705,\"lon\":-2.995885834237245,\"address\":\"Royal Liver Building, Saint Nicholas Place, Vauxhall, Liverpool, Liverpool City Region, England, L3 1HU, United Kingdom\",\"countrycode\":\"gb\",\"city\":\"Liverpool\",\"state\":\"England\",\"country\":\"United Kingdom\",\"postalcode\":\"L3 1HU\",\"boundingbox\":[\"53.4054389\",\"53.4062298\",\"-2.9966295\",\"-2.9951429\"],\"type\":\"attraction\",\"selected\":true,\"zoomTo\":true}}",
  created_at: Fri, 10 Feb 2023 14:00:07.158098000 UTC +00:00,
  updated_at: Fri, 10 Feb 2023 14:00:07.158098000 UTC +00:00>,
 #<TopicCustomField:0x00007ff170e117e8

whatā€™s also interesting is this code:

  clearModal() {
    this.setProperties({
      name: null,
      street: null,
      neighbourhood: null,
      postalcode: null,
      city: null,
      state: null,
      countrycode: null,
      geoLocation: { lat: "", lon: "" },
      rawLocation: null,
    });

itā€™s as if geoLocation was never meant to have the rest of the fields?

@angus Iā€™m mid a major-ish refactoring job atm and the purpose of this difference would be really useful info - why is there a ā€œstreetā€ and a ā€œgeolocation: streetā€ for example?

This may present a problem in that we canā€™t simply re-use the same infra in, for example, CW to handle them both without some checks and difference in reference which may get a bit clunky?

@NathanK this PR was a lot more work than I anticipated, so Iā€™m sorry, but I donā€™t think Iā€™m going to be able to look at this discrepancy right now, Iā€™m simply under too great a work load.

1 Like

No problem - Iā€™ve noticed that youā€™ve been beavering away at that for a few days! And Iā€™m not in a rush - very much in the ā€˜nice to have one dayā€™ bucket.

And this CWP / user location thing looks like a bit of a deeper problem too.

1 Like

Thanks for your understanding. Letā€™s see what Angus says about the discrepancy.

Well brought up!

1 Like

@merefield @NathanK Guys, we shouldnā€™t be investing time in this right now. @merefield I need your help to get the subscriptions stuff done and dusted.

A seamless integration between the Custom Wizard and Locations for the purpose of populating user location data is a feature request which we donā€™t have capacity for at the moment.

Please put this on hold.

2 Likes

@angus this is coming up again because of a client ā€¦ so an opportunity perhaps to get this to work for Users.

Can you confirm this was always only a Topic concept in CW?

I note in the schema this:

    create_topic: {
      title: null,
      post: null,
      post_builder: null,
      post_template: null,
      category: null,
      tags: null,
      visible: null,
      custom_fields: null,
      skip_redirect: null,
      suppress_notifications: null,
      add_event: null,
      add_location: null,
    },

but there is nothing explicit for Users

The client may also want to automatically assign timezone as part of location input, which is an interesting request.

(cc: @Bhanu)

3 Likes

Sorry Iā€™m not sure what you mean by ā€œUsersā€ here?

Was users recording their location (for profile and users map) via the wizard ever a thing?

It is clear topic location was, but not users.

Not that I recall, no. I donā€™t think weā€™ve ever supported that exactly. It may have been possible using custom fields somehow, but the locations integration was focused on topic locations.

Supporting user locations shouldnā€™t be too hard though. It may be possible if you set up custom fields in the right way using the update profile action?

1 Like

Yeah, I thought so, but sure, letā€™s see if we can get it to work in any case.

Itā€™s presently broken for Topics so Iā€™m focussing on that since it is explicitly supported.

1 Like

Please note, User Locations is not supported afaik.

Topic Location relies on this UI on this bespoke UI under ā€œCreate Topicā€:

An equivalent does not exist for User Locations.