Giter Site home page Giter Site logo

wme-place-harmonizer's People

Contributors

bmtg avatar corycharlton avatar datorres-bae avatar dbsooner avatar jangliss avatar jm6087 avatar justins83 avatar mapomatic avatar ravendt avatar t0cableguy avatar tonestertm avatar vtnerd91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wme-place-harmonizer's Issues

Refactor: "use strict" ?

I noticed WMEPH doesn't "use strict".

I want to know what you guys think about maybe as a part of the refactoring process, attempting to "use strict" coding practices in an effort to reduce "loose" code.

Advantages:

  • Makes it easier to write "secure" JavaScript
  • Changes previously accepted "bad syntax" into real errors.
  • Enforce variable scoping. Normally, you attempt to assign a value to a variable out of scope, it creates a new global variable. In strict mode, it'll throw an error.
  • Will receive error feedback assigning values to non-writable properties
  • Any assignment to non-writable property, getter-only property, non-existing property, non-existing variable, non-existing object, will throw an error.

Disadvantages:

  • It'll probably take a lot of work to implement.

What are your thoughts?

Check hours for same open/close times. Bug?

Waze has a save error when a place has the same open and close times set (e.g. 9a-9a). This was not generated by WMEPH, but it would be nice if it checked for the issue.

PNH not replacing matched name with PNH approved primary in some cases

PNH is not replacing approved name in some cases. Examples include Country Inns & Suites by Carlson, and some hotels with "localizers"

The localizers would be ideally saved, but the PNH name would need to replace the matched search name.

When this occurs users are not able to follow the PNH sheet as the script intends. This is a mild bug, as it does not make WMEPH stop working, but it is a High priority because the script is not working as intended with the PNH Sheet.

PLA flags missing

Review and address any missing PLA flags, such as blue for missing details.

Wont run on a place without a state name.

note from readme. **Note that for some app-submitted places, no state name is stored. In these cases, you have to enter at least a city and street in the address field for the script to run.

It would be ideal to fix this issue. however this has been an issue for a long time.

Add services icons not working correctly (e.g. 24/7)

If 24/7 is "on" and you click any other services icon, it turns 24/7 off (doesn't affect the actual hours). One report said that other icons are also affected, but it isn't consistent. Also noticed that clicking 24/7 when hours already exist doesn't seem to work as expected. And adding hours manually doesn't cause 24/7 to turn off (not sure if it used to, but it should).

Hospital/Medical category - Always give option of convert to Offices

Currently for point Hospital/Medical the script attempts to guess if something looks like a hospital and offers to convert to Offices. But in a great many cases it guesses wrong and only offers the option to change to area.

I'd like to suggest that for these point places the option of "Convert to Area" and "Convert to Offices" should be universally available, without trying to guess

Identify PNH Sheet Modifiers for WMEPH worksheet.

We need to fully identify and document modifiers for WMEPH worksheet in the PNH sheet so we can continue to maintain the functionality of the script.
Items such as notAbank and brandParent# etc. need to be documented so others can maintain it.

Failing to infer address

Categorizing this a major bug because it could affect a lot of places (not sure). It affects at least some (all?) places that don't have an address.

This line:
W.geometryEditing.editors.venue.navigationPoint.lonlat.toPoint();

Causes this console error:

VM796:6207 Uncaught TypeError: Cannot read property 'venue' of null
    at WMEPH_inferAddress (eval at <anonymous> (:2:297), <anonymous>:6207:38)
    at harmonizePlaceGo (eval at <anonymous> (:2:297), <anonymous>:3084:47)
    at harmonizePlace (eval at <anonymous> (:2:297), <anonymous>:1637:21)
    at HTMLInputElement.btn.onclick (eval at <anonymous> (:2:297), <anonymous>:5119:25)

JustinS83 says:

Failing to infer the address
W.geometryEditing.venue no longer exists
Was changed because of upcoming multiple entry/exit points
You have to iterate the array
selectedItem.model.attributes.entryExitPoints
At this point, just pull [0]

Maybe a simple fix?

Refactoring: typescript

This is a radical idea, but I think a good one. Typescript is a definitely typed version of Javascript that my team at work uses. We code in TS and then use the typescript transpiler to render as plain Javascript.

Running this way has all but eliminated the plague of runtime type errors that Javascript is prone to because type errors are caught by the IDE. Also gives you excellent intellisense capability.

Like I said we've had a lot of success with typescript at work and I personally think it takes most of the pain of Javascript out of the equation while keeping its flexibility

Refactoring - split code logically intuitive separate related files

One big monolithic file makes it harder to track down issues. Splitting the code into separate files based on logical relationships (say the hours parser could have its file or group of files, the services buttons another). This makes maintenance and development of new features much easier. You would then run a minifier to combine everything into a single script for tampermonkey to consume

Add a check for Google Linking

Would factor in to both completion and highlighting levels. Personally, I'd like to see it be a requirement for Green.

Ultimate dream would be if it could be automatically found by the script and proposed for verification. But that's probably for another day.

Multiple instances of wmeph causes conflicts

Need to detect when multiple versions of wmeph are running and inform the user to remove or disable the old versions. The code is in the script to detect when beta and prod are running at the same time, we need to fix the names in the script so that works again, however when running two production versions or two beta versions the script can cause issues with itself.

Refactor: Trace common functions for overcalling

So, I was working on capitalization functions and in order to easily find the process that takes place when the script button is pressed, I added some logging. This was the result of ONE button press on ONE venue with ONE name (and two alternate names):

WMEPH-Beta: Running script on selected place...

First round of function calls:

Calling toTitleCase() from line 2241.
toTitleCase(Herndon - Monroe Deck #250 (customers only)) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon-Monroe Park & Ride) was called.

Second round:

Calling toTitleCaseStrong() from line 2901.
toTitleCaseStrong(Herndon - Monroe Deck #250 (Customers Only)) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon-Monroe Park & Ride) was called.

Third round:

Calling toTitleCase() from line 2241.
toTitleCase(Herndon - Monroe Deck #250 (Customers Only)) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon-Monroe Park & Ride) was called.

Fourth round:

Calling toTitleCaseStrong() from line 2901.
toTitleCaseStrong(Herndon - Monroe Deck #250 (Customers Only)) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon-Monroe Park & Ride) was called.

Fifth:

Calling toTitleCase() from line 2241.
toTitleCase(Herndon - Monroe Deck #250 (Customers Only)) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2246.
toTitleCase(Herndon-Monroe Park & Ride) was called.

Sixth:

Calling toTitleCaseStrong() from line 2901.
toTitleCaseStrong(Herndon - Monroe Deck #250 (Customers Only)) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon Monroe Parking) was called.
Calling toTitleCase() from line 2976.
toTitleCase(Herndon-Monroe Park & Ride) was called.

As far as workflow goes, I think we should create separate issues for each inefficiency we find. As long as we add them to the "Refactor 2017" project, it shouldn't be an issue. But this way, as we tackle individual problems, we can scratch them off, instead of trying to fix them all under one issue.

Confirm hours before adding

Some places don't list am/pm and it's easy to copy/paste and forget about it. We should add some way to verify that the hours being added are am/pm.

PM bug reports.

When making a PM bug report, for multiple match, include the row numbers in the subject.
Include a PL of the location in question for testing. I might be able to fix this myself, but I'd appreciate a quick fix on this.

Limit Google link search distance

Feature request. Does this make sense in WMEPH?
Add something in wmeph like jnf had that limited the distance when searching for linked places

Clean up bootstrap & initialize functions

There are multiple bootstrap and external setTimeout functions that run before anything gets done. I don't see any need for the setTimeout functions that don't serve a "wait a moment before retrying" purpose. Those could be stripped down. I would recommend a bootstrap that waits for necessary Waze functionality to load, then calls a single init function. The init function would handle calling any other functions that load external resources, set up the initial UI, and then wait for any async functions to finish before adding listening events.

URLs with https:// won't open when using 'Place Website' button

This is due to the fact that WMEPH strips http:// in the beginning of the address and then adds it back on later when creating the button. Technically, a normalized URL (in IT perspective) is made up of a protocol, domain, then resource in the format: protocol://domainname/resource?key1=value1&key2=value2 (etc.)

Line 776:
var m = s.match(/^http:\/\/(.*)$/i); // remove http://

Won't match "https://". It could be easily fixed to match either, but then the protocol would still get stripped, and some websites don't perform a URL rewrite on http requests to change them to https.

There are three options to solve this problem:

  1. Change the regex in line 776 to be /^https?:\/\/(.*)$/i); and hope that when the URL gets http:// added back again, the website forces a URL rewrite on their end.
  2. Leave line 776 as-is, but instead change line 1659 from:
openPlaceWebsiteURL = 'http:\/\/' + newURL;

to

if ( /^http:/.test(newURL) ) {
   openPlaceWebsiteURL = 'http:\/\/' + newURL;
}
  1. Change normalization procedures to include protocol (to include PNH table). Change code to check to see if URL begins with http or https. If it doesn't, prepend with "http://".

How to handle unnamed PLA's?

Currently, unnamed PLA's can't be locked because they are "red". nzahn stated that he thought this was a potential problem due to the # of (legitimate) unnamed PLA's that will probably be created in the future.

Some ideas:

  1. Use shared / merged whitelists. This sounds good in theory, but I don't know if it works in practice. People tend to keep to themselves and rarely, if ever, share whitelists. However, if there were shared whitelists by region and/or state, and these were actively promoted and maintained by RC's and/or SM's, this would seem more feasible.

  2. Don't flag/lock PLA's with missing names. Probably not a good idea if we want to encourage naming PLA's that really need a name.

  3. Allow manual locking of unnamed PLA's. If user manually locks, it's assumed the name was intentionally left blank and flag can be removed.

  4. Create a slightly different outline for unnamed PLA's vs named PLA's. Users can see there's something different about them, but they don't show up bright red and visually pollute the map.

Idea: Make buttons and input fields slightly smaller

... And I do mean slightly. I am willing to bet a lot of WMEPH users are older and their eyesight might not be so good.

One major win would be altering the bullet list so there wouldn't be so much wasted space between the bullets and the text. That and it looks a bit tacky.

Flag un-GLinked place pins

I haven't done a study but off the top of my head I would estimate that about 15% of the URs I fix could have been prevented were the pin for the place GLinked to its google equivalent.

As such I wanted to suggest that we have some way of flagging that a place isn't fully complete if it isn't GLinked. I would say this behavior would only be enabled for editors of a rank to be able to GLink a place. I was thinking leave it blue, Josh suggested adding another color option. The specifics can be worked out, I just wanted to request some means of flagging these places (Needs to be white-listable)

Using WL on an unsaved place doesn't work properly.

Places are initially assigned a temporary negative ID value starting at -100 (and decrementing with each new place) until they are saved and they receive their permanent ID. The temporary ID is stored in the whitelist if applied before the place is saved. Once saved, the place "loses" its WL. Also, the next time the page is refreshed, the starting ID value for new places resets to -100, so any whitelisted issues previously assigned to those negative ID's will be applied to new places (though they will also "lose" them once saved).

A couple potential options:

  1. Listen for a place save, retrieve the new ID, and assign it to WL entries with the old temporary ID
  2. Prevent WL until the place is saved (i.e. until it has a positive ID #).

From a usability perspective, item 1 would be the best option if it is possible.

Limit phone numbers to 10 digits.

Occasionally I'll run across a place with a phone number spelled out in letters (E.G. White Castle's official phone number is 1-800-THE-CRAVE). The phone number parser should be able to parse out what numbers those correspond to in a traditional phone keypad

Feature request: Zoom to/center on place

I'd like to see a "zoom to place" button on the script.

I see two main use cases:

  1. Sometimes I'm editing a place and I'll sometimes zoom out or pan around a bit to figure out where exactly it's located in relation to major roads around it so I can find its address in GIS (this is mainly used when the place doesn't have a website). Then sometimes I'll lose track of the place trying to come back to it.
  2. Editing area places from space. I'll often select area places with dotted blue or green highlights as easy quick edits to complete the places and lock them. But sometimes you need to zoom in to check their nav points or other details. It would be nice to not have to do this manually.

"Highlight test" is run repeatedly when multiple changes are applied

The applyHighlightsTest function is called repeatedly whenever multiple changes are applied, e.g. when Run WMEPH changes several fields. It's caused by this code in bootstrapWMEPH_CH function:

// Add listeners
W.model.venues.on('objectschanged', function (e) {
      applyHighlightsTest(e);
});

So every time a venue is changed, the function is called. To fix this, we could add a global boolean value (call it _disableHighlightsTest or something like that) and set it to TRUE whenever multiple updates need to be made. Then set it back to false afterward and then call applyHighlightsTest manually.

Change the bootstrapWMEPH_CH function to look like this:

// Add listeners
W.model.venues.on('objectschanged', function (e) {
      if(!_disableHighlightsTest) {
            applyHighlightsTest(e);
      }
});

Estimate # of parking spots in parking lot?

Re: [Script] WME Place Harmonizer: Version 1.1, Mar 2016
postby benandjerry » Thu Dec 15, 2016 4:01 am

Not sure if feasible, but can the PH recommend an expected lot size (amount of cars)?

I did some size vs. surface area measurements and found that a decent average is 3 cars per 1000sq.ft.

Using the toolbox measurement tool for surface area it is then easy to divide the area by 1000 and multiply by 3 to get to the average amount of cars for the lot.

Refactor all code

This is an internal enhancement that RavenDT and I believe would help code readability / stability, eliminate some bugs, and help prevent new ones from appearing.

This will be a big undertaking, so deciding on when / how to implement will be important. I recommend that we finish tackling any MAJOR bugs, then work on a refactoring plan. Once we are ready to start, create a new branch off of Beta. Any minor bug fixes done in Beta after that point should also be fixed in the new branch so they are not re-introduced later.

We believe this should be done as soon as possible, while maintaining the major functionality in the Beta version, i.e. ignore minor Issues as much as possible until the refactoring is complete, and add a "this is in the refactored code" comment to any Issues that are solved during refactoring.

Let's discuss further, once all major bugs are tackled...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.