Esri / geotrigger-editor

Visual editor for Esri's Geotrigger Service.
https://developers.arcgis.com/geotrigger-service/
Apache License 2.0
21 stars 13 forks source link

Tags changing their name mysteriously #190

Closed jerryhamby closed 10 years ago

jerryhamby commented 10 years ago

I have placed this in support but no one has been assigned. I though this might qualify as a bug so I'm posting it here.

985 Tags changing their name mysteriously

I noticed today that the tag name on several of my triggers had changed and I just can't find anything within my code that can explain it. All of my trigger tags should be set to "futuretravel".My code sets all trigger tags to "futuretravel" and I purposefully never change it for testing reasons. JSONObject vParams = new TriggerBuilder() .setTriggerId(vID) .setTags("futuretravel") The change I noticed is that the tag "futuretravel" was being replaced by the triggerId name. So I was getting: triggerID:"banana-republic" and tag:"banana-republic" instead of: triggerID:"banana-republic" and tag:"futuretravel"

I did check with my partner Doug and he said he didn't make any changes in the Geotrigger Editor. So I manually updated the tags using the Editor, but I thought I should report this issue.Don't know if this is a Geotrigger Editor or server issue, but I'm pretty sure it's not my Android code.

phpmaps commented 10 years ago

Hi Jerry - Were you given a Support Incident number? If so can you please email me it? My email is dcarroll@esri.com.

jerryhamby commented 10 years ago

985

On Jan 9, 2014, at 1:08 PM, Doug Carroll wrote:

Hi Jerry - Were you given a Support Incident number? If so can you please email me it? My email is dcarroll@esri.com.

— Reply to this email directly or view it on GitHub.

mannylopez commented 10 years ago

Hi Jerry - We are taking a look at this. First time we are hearing of it. Thanks for reporting!

patrickarlt commented 10 years ago

I've been unable to reproduce this using just the geotrigger editor. If you have reproducible steps using only the geotrigger editor feel free to reopen this issue.

jerryhamby commented 10 years ago

It just happened again when I opened the editor. I tested on my Mac with Safari and Chrome. Notice the tag names for "banana-republic" and "hooters", it should be "futuretravel"

screen shot 2014-01-09 at 2 23 43 pm

jerryhamby commented 10 years ago

screen shot 2014-01-09 at 2 32 33 pm

jerryhamby commented 10 years ago

Please notice that no where in my code do I place anything other that "futuretravel" into a tag 1- .setTags("futuretravel") 2- "placename" gets used to populate .setNotificationText(vMess) 3- "vID" gets used as the .setTriggerId(vID)

locBananaRepublic.setLatitude(34.018454127945006); locBananaRepublic.setLongitude(-118.49908710457385); makeTrigger(locBananaRepublic, "Banana Republic", "banana-republic", "http://www.vdex.com", 100, "enter", "550e8400-e29b-41d4-a716-446655777777");

public void makeTrigger(Location loc, String placename, String vID, String vURL, int vRadius, String vDirection, String vUUID) {

if (vDirection=="enter") { vDir = TriggerBuilder.DIRECTION_ENTER; vMess = "You're approaching "+ placename; } else if (vDirection=="leave") { vDir = TriggerBuilder.DIRECTION_LEAVE; vMess = "You're leaving "+ placename; }

JSONObject vParams; if (vURL=="") { vParams = new TriggerBuilder() .setTriggerId(vID) .setTags("futuretravel") .setGeo(loc, vRadius) .setDirection(vDir) .setNotificationText(vMess) .setNotificationData(vData) .build(); } else { vParams = new TriggerBuilder() .setTriggerId(vID) .setTags("futuretravel") .setGeo(loc, vRadius) .setDirection(vDir) .setNotificationText(vMess) .setNotificationUrl(vURL) .setNotificationData(vData) .build(); }

GeotriggerApiClient.runRequest(this, "trigger/create", vParams, new GeotriggerApiListener() {

jerryhamby commented 10 years ago

The Editor seems to be using the data I put into the .setTriggerId(vID) for the tag info (but not for every trigger, very puzzling ??? ) "banana-republic" stored inside var vID is my triggerId

jerryhamby commented 10 years ago

I think I have found the source of the problem:

1- I create the trigger = (setTags":["futuretravel"]) "01-09 23:59:10.345: V/GeotriggerSDK(5194): [ymjay] Sending request to 'https://geotrigger.arcgis.com/trigger/create'. 01-09 23:59:10.352: V/GeotriggerSDK(5194): [ymjay] Request post body: {"action":{"notification":{"data":{"thedata":"550e8400-e29b-41d4-a716-446655666666"},"url":"www.hooters.com\/","text":"You're approaching the Banana Republic"}},"setTags":["futuretravel"],"condition":{"direction":"enter","geo":{"distance":125,"longitude":-118.4954025875777,"latitude":34.01617035269737}},"triggerId":"banana-republic"}

2- Here is the response. The Geotrigger server not only created a trigger with my tag "futuretravel", it also magically created it own, which I didn't ask for. tags":["futuretravel","trigger:banana-republic"]. This is what the Editor is using to display, which explains why the tag info is wrong.

01-09 23:59:11.415: V/GeotriggerSDK(5194): [t92aw] Response entity: '{"triggerId":"banana-republic","condition":{"geo":{"latitude":34.018454127945006,"longitude":-118.49908710457385,"distance":100,"geojson":{"type":"Polygon","coordinates":[[[-118.498004379375,34.0184673232853],[-118.498022093221,34.0182911802762],[-118.498080734644,34.0181212994184],[-118.498178049868,34.017964209088],[-118.498310298967,34.0178259460973],[-118.49847239962,34.0177118237152],[-118.498658122423,34.0176262274967],[-118.498860330281,34.0175724467642],[-118.499071252661,34.0175525482151],[-118.499282784181,34.0175672965094],[-118.499486796056,34.0176161248891],[-118.499675448444,34.0176971569566],[-118.499841491692,34.0178072787761],[-118.499978544918,34.0179422585281],[-118.500081341208,34.0180969091208],[-118.50014593003,34.0182652875105],[-118.50016982907,34.0184409230765],[-118.500152119655,34.0186170662724],[-118.500093482096,34.0187869480034],[-118.499996169581,34.0189440397601],[-118.499863921622,34.0190823045132],[-118.499701820368,34.0191964287256],[-118.499516095314,34.0192820265636],[-118.499313883898,34.0193358084581],[-118.499102957194,34.019355707535],[-118.498891421242,34.0193409590538],[-118.498687405503,34.019292129801],[-118.498498750408,34.0192110963072],[-118.498332706019,34.0191009727252],[-118.498195653394,34.0189659911429],[-118.498092859355,34.0188113389308],[-118.498028274091,34.018642959379],[-118.498004379375,34.0184673232853]]]}},"direction":"enter"},"action":{"notification":{"data":{"thedata":"550e8400-e29b-41d4-a716-446655777777"},"url":"http://www.vdex.com","text":"You're approaching Banana Republic"}},"tags":["futuretravel","trigger:banana-republic"],"rateLimit":0,"times":0,"properties":null}'.

Is this your bug or do I have to adhere to a trigger naming scheme like: "trigger: futuretravel". I would prefer this tag naming NOT be restrictive.

jerryhamby commented 10 years ago

How do we change this issue from closed to opened?

patrickarlt commented 10 years ago

@jerryhamby tag naming is not restrictive. The API automatically generates tags like trigger:TRIGGER_ID for you for convenience as described here https://developers.arcgis.com/en/geotrigger-service/api-reference/tag/#default-tags.

I would also recommend taking a look at the setTags, addTags and removeTags properties in the trigger documentation. https://developers.arcgis.com/en/geotrigger-service/api-reference/trigger/. Its worth noting that if you use setTags twice. I.e. create a trigger in the Android SDK then edit the tags list it in the editor it will overwrite all existing tags with the new value of setTags. If you want to add the banana-republic tag to your trigger tagged with futuretravel you need to use addTags not setTags.

Android code is also not helpful in debugging this issue. For there to actually be a bug in the Geotrigger Editor you should be able to reproduce tag names changing for no reason using only the editor. Rather then a combination of the editor and the Android SDK

Its also helpful if you wrap code blocks in "```" so it will format then nicely for you https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks

ungoldman commented 10 years ago

@jerryhamby Default tags (preceded by trigger:) will always be there -- they are automatically generated by design and can't be deleted or replaced, and are unique to each trigger. Please refer to the link to documentation provided by @patrickarlt above.

Default tags are filtered out of the tag list in the Geotrigger Editor to avoid confusion when using custom tags (https://github.com/Esri/geotrigger-editor/blob/master/src/js/lib/handlebars.helpers.js#L98) as they can't be modified or removed.

It seems in your earlier post that String placename may be getting set as a tag somewhere not shown in your code and overwriting the previous tag futuretravel, since the tag showing up in the editor is "Banana Republic" (the string passed to your custom function) and not "banana-republic" (the trigger ID). I'm also seconding @patrickarlt's suggestion to read the documentation for clarification about the difference between setTags, addTags, and removeTags (https://developers.arcgis.com/en/geotrigger-service/api-reference/trigger/).

To reiterate, this does not appear to be an issue with the Geotrigger Editor as it is only reporting what it's getting back from the Geotrigger API. Please post issues related to the Android SDK here.

jerryhamby commented 10 years ago

Thanks @patrickarlt @ngoldman

I will review your comments, do a little studying and adjust my approach as needed. But I do consider my code and the Editor as one big ecosystem and when I see things that don't match I pursue that matter as part of my beta testing efforts. Sometimes. I'm on the money, other times I miss the boat. Your links to the docs has been helpful, thanks.

Back to this bug issue: The docs state tags are: Automatically generated tags are not discoverable by default @ngoldman stated: 'Default tags are filtered out of the tag list in the Geotrigger Editor to avoid confusion when using custom tags"

Today I opened the Editor and all my tags are displaying correctly. So this is confusing, yesterday I was seeing the Editor NOT filter out the default tag and today only my custom tags are displaying, which is the expected behavior. Did you change the server code?

Just one more side issue, I haven't tested this use case yet, will the Editor display my multiple custom tags in a comma delimited fashion, when I get around to testing addTag?

patrickarlt commented 10 years ago

The editor handles comma delimited tags just fine. The editor only uses setTags when editing triggers so any tags you set in the editor will override any existing tags on the trigger.

geotrigger_editor geotrigger_editor

Editor code hasn't been changed in 4 days according to https://github.com/Esri/geotrigger-editor/tree/gh-pages