question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

donejs-next place-my-order restaurant set comparator doesn't work as expected

See original GitHub issue

In the updated place-my-order guide the restaurant set comparators don’t appear to work as expected. They express a statement that will always return true - checking if the restaurantValue is equal to property on the restaurant object where restaurantValue has been read from:

  {
    "address.city": function(restaurantValue, paramValue, restaurant){
      return restaurant['address.city'] === restaurantValue;
    },
    "address.state": function(restaurantValue, paramValue, restaurant){
      return restaurant['address.state'] === restaurantValue;
    }
  }

This ends up returning the complete set of restaurants when making a request that should be filtered by address.

The request is being made like: list.js

Restaurant.getList({
    'address.state': state,
    'address.city': city
});

and against the fixtures in the test like: list-test.js

restaurantStore.getList({"address.city": "Alberny"})

Both those end up returning the complete set of restaurants. When using different syntax:

Restaurant.getList({address: {state, city});
...
restaurantStore.getList({address: {city: "Alberny"}})

These requests end up returning the filtered list as expected during the test, without ever hitting either can-set comparator. Wondering why we were using the previous syntax at all.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nlundquistcommented, Apr 13, 2017

can-set 1.2.0 has the new set.prop.dotNotation so I’ll update the guide to include it’s use

1reaction
phillipskevincommented, Apr 11, 2017

Just going to paste here what we talked about, we want to make something like this work and then use it in the guide:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Array sort is not working correctly in JavaScript - Stack Overflow
The code above will return the array sorted from smallest to largest correctly. You can sort largest to smallest (descending order) by reversing ......
Read more >
How to Conduct an Accurate Restaurant Sales Forecast - Toast
Restaurant sales forecasting helps you control inventory, staff wisely, and predict profits. Learn more about how to conduct a restaurant sales forecast.
Read more >
Fine Dining Etiquette for Servers - WebstaurantStore
Serving in a fine dining atmosphere requires proper etiquette. Follow these tips so you can adhere to professional standards, ...
Read more >
Chefs and Head Cooks : Occupational Outlook Handbook
Chefs and head cooks oversee the daily food preparation at restaurants and other places where food is served.
Read more >
JavaScript Promise Tutorial – How to Resolve or Reject ...
But, a callback is not a special thing in JavaScript. It is a regular function that produces results after an asynchronous call completes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found