Skip to content

QueryBuilder fix and feature #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

joeljeske
Copy link

I fixed a bug in the each() method on the ObjectStore where only the first item can be accessed using the cursor approach. When using a cursor, the onsuccess function is called multiple times and cursor.continue() re-calls the method with the next value. Using $q.promise, the listener can only be called once with the first item. To continue to allow the caller to select with items to be added to the list, I added a $filter option when creating a QueryBuilder. This option allows the selection of a function to be called for each item in the cursor. It is called with one argument being the value (cursor.value), and if it returns truthy, the item is added to the result set which is eventually returns in the promise resolution. I don't know of another way to allow independent selection of values when using a promise and resolution.

In working further with your tool, I have found that the QueryBuilderDefaults are changed directly instead of being copied when make a new query. I have add a call to angular.extend({}, defaults) to correct this bug.

joeljeske added 2 commits May 31, 2014 14:47
…etermine if it should be added to the result set. Fixed error in where is called for each cursor but promise resolve can only be called once
@joeljeske joeljeske changed the title QueryBuilder fixe and feature QueryBuilder fix and feature May 31, 2014
@bramski
Copy link

bramski commented Sep 4, 2014

Hey @joeljeske Can you rebase and move your PR to https://github.com/bramski/angular-indexedDB

I'm taking over maintenance of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants