Jump to content

Geocache Object, Attributes Array: provide negated name if isOn equals false


Recommended Posts

Posted

Each geocache object comes with an array of attributes structured like this:

 

{
            "id" : 6,
            "name" : "Recommended for kids",
            "imageUrl" : "https://www.geocaching.com/images/attributes/kids-yes.png",
            "isOn" : true
        }, 
        {
            "id" : 1,
            "name" : "Dogs",
            "imageUrl" : "https://www.geocaching.com/images/attributes/dogs-yes.png",
            "isOn" : true
        }, 

 

As can be seen, there are cases where "isOn" is set to "false". In these cases, an image with a diagonal red bar  is provided, however "name" is not negated and cannot be easily negated by just prefixing it with "No".

 

It certainly works for "No Dogs" but "No recommended for kids" makes no sense. There are 72 attributes and the "isOn == false" text cannot be "calculated" by the client application. Consequently I would like to kindly suggest that not only the imageUrl points to a different image relative to isOn true or false but also the "name" property should reflect the isOn equals true or false state.

 

Alternatively or perhaps in addition, the method: "getAttibutes" should also provide both name variant strings.

 

Without this change a well designed client application must construct its own manual mapping table which essentially requires to lookup geocaches via the geocaching.com website and specifically extract the true / false texts and do so for as many such lookups it takes until all 72 ids have been found in both variants, true and false. Not only is this tedious work, in addition it will inevitably lead to run out of sync with what is displayed on the geocaching.com website.

  • Upvote 1
Posted
19 hours ago, hxdimpf said:

Without this change a well designed client application must construct its own manual mapping table which essentially requires to lookup geocaches via the geocaching.com website and specifically extract the true / false texts and do so for as many such lookups it takes until all 72 ids have been found in both variants, true and false. Not only is this tedious work, in addition it will inevitably lead to run out of sync with what is displayed on the geocaching.com website.

 

It's a bit of a "temporary hack", but you can get the texts of each yes/no attribute by opening any (unpublished?) geocache you own, going to the edit page, and running the following Javascript in the console:
 

JSON.stringify(JSON.parse(document.getElementById("GeocacheJson").value).attributes)

 

This produces:

 

[
  {"id":24,"state":0,"hasYesOption":true,"hasNoOption":true,"iconName":"wheelchair","name":"Wheelchair accessible","yesText":"Wheelchair accessible","noText":"Not wheelchair accessible"},
  {"id":6,"state":0,"hasYesOption":true,"hasNoOption":true,"iconName":"kids","name":"Recommended for kids","yesText":"Recommended for kids","noText":"Not recommended for kids"},
  {"id":41,"state":0,"hasYesOption":true,"hasNoOption":true,"iconName":"stroller","name":"Stroller accessible","yesText":"Stroller accessible","noText":"Not stroller accessible"},
  // ...
]

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...