Skip to content
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

Update applyPatch function and add tests for it #574

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

Jan-PieterBaert
Copy link
Contributor

The applyPatch function had a few small bugs when I tried it, so I fixed those and added tests for the function

@angelo-v
Copy link
Contributor

Hi and thanks for your contribution. Can you please describe what bugs you experienced and how your changes fix those?

@Jan-PieterBaert
Copy link
Contributor Author

The bugs I found:

  • the substitute function of a collection didn't seem to work with the current constructor, creating a new collection and adding the elements did work
  • in the applyPatch function patch['insert'] was always used, but in the function declaration it said 'patch'
  • the ds = ds.statements line meant that if there was a where clause this statement would be executed twice instead of once which meant there would suddenly need to be a ds.statements.statements
  • since the other functions seem to assume ds is a collection and the elements of a collection are accessed via elements and not statements I edited that as well
  • the targetKB.query function failed because the initBindings was always undefined, the code seemed to assume it's a list so I made it an empty list

@angelo-v angelo-v requested a review from timbl September 19, 2022 21:39
Copy link
Member

@timbl timbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the face of it this all seems to make sense.

@timbl
Copy link
Member

timbl commented Feb 23, 2023

Looking back at this now it is merged (and broken for solid-ui.) ds was designed to be an Array, not a Collection - which code expects it to be a Collection?

@timbl
Copy link
Member

timbl commented Feb 23, 2023

So the test is wrong too. The parameters are expected to be IndexedFormulas, not collections. Let's roll this back. Sorry I don't read it carefully in review.

timbl added a commit that referenced this pull request Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants