Skip to content

Read every value of a property in Fbe.same? so a later time matches - #1328

Open
Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1240
Open

Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1240

Conversation

@Thayorns

Copy link
Copy Markdown
Contributor

Fbe.same? read a property with fact.public_send(k), which gives back only its first value, so the .flatten around it had nothing to do. When the query found a fact by a Time that sat in the second or a later value, same? rejected it, and Fbe.if_absent and Fbe.just_one went on to insert a duplicate.

It now reads fact[k.to_s], which is every value of the property, and checks the time against all of them. A time that is in none of the values is still refused.

There was no test file for same.rb, so this adds one, together with a test in test_if_absent.rb and one in test_just_one.rb that insert a fact with two times and make sure no second fact appears.

Closes #1240

@Thayorns

Copy link
Copy Markdown
Contributor Author

@yegor256 take a look please, happy to clarify anything about the change.

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.

Fbe.same? looks only at the first value of a property, so if_absent and just_one create duplicates

1 participant