-
Notifications
You must be signed in to change notification settings - Fork 49
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
Tv4g1 issue1843 publishing cardinality #1882
Conversation
I have not yet added any testing, but this is working so I thought I'd open it up for functional testing and code review. |
I build a new docker and created two contacts and five projects (so that I could make sure id's did not overlap)
etc. but this was using the wrong branch, let's try again |
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Thanks @dsenalik for the quick check! Hmmm looks like something is still wrong. I'll see what's up. I'm also seeing a functional test fail. |
OOPS! I used the wrong branch, from PR #1867 🙈 - building a new docker |
There is something wrong with publishing an organism. I create it manually with Then when I publish |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review is based on including my last two suggestions, and testing with publishing two organisms one at a time as described in comment #1882 (comment) now works correctly.
I tested elsewhere more thoroughly, everything appears to be working as intended.
In addition to project-contact, I linked two publications to analysis and these published correctly.
GFF importing and publishing gene, mRNA worked also.
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Thanks @dsenalik for the testing! I've integrated all of your suggestions. I'm working on functional tests right now, so hopefully will have some of that soon. |
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested everything I had tried previously, and everything is working as expected.
I do have a number of typos that I spotted, but otherwise this is a super-awesome PR!
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Co-authored-by: Douglas Senalik <dsenalik@wisc.edu>
Thanks @dsenalik for the additional review! It looks like your mispelling fixes got merged in. I just approved the one where you made a change to the regex. @laceysanderson in answer to this question:
I don't know :-) Something I brought in accidentally and it has been removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review suggestions. The suggestions in the test are improvements only. I may have found a bug in chadorecord changes though.
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
tripal_chado/tests/src/Functional/Services/ChadoTripalPublishTest.php
Outdated
Show resolved
Hide resolved
$record_id = $record_id; | ||
$this->setColumnValue($base_table, $table_alias, $delta, $column_alias, $record_id); | ||
$base_table = $record['link_columns'][$column_alias]; | ||
$this->records[$base_table]['tables'][$table_alias]['items'][$delta]['values'][$column_alias] = $record_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to add a comment here why you didn't use setColumnValue so it doesn't get changed back in the future 🙈
Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
…est.php Co-authored-by: Lacey-Anne Sanderson <lacey.sanderson@usask.ca>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the changes @spficklin, this looks good to merge to me!
Merging this since we have 2 reviews and passing tests! Thanks @spficklin for fixing this pesky one!!! |
Bug Fix
Issue #1843
Tripal Version: 4.x
Description
This PR solves the issue described in issue #1843 where field values derived from linked tables in Chado were only showing the first item and ignoring the others. In actuality the problem was that the testing we did made it look like it was publishing the first item but in fact it was publishing the wrong thing but because record IDs were similar between the base record and linked record we didnt notice. For example. If you add a project and link two contacts to it, then publishin the contacts on the project, it looked like it only added one, but it was really publishing a contact with the same record ID as the project not the contact. Since the first contact was what was desired it looked like it was working .
There were multiple issues that this PR solves in both ChadoStorage and TripalPublish:
ChadoStorage::findValues()
function sets the field property values after it finds all of the fields. One property that all fields have is therecord_id
which always points to the base record. When we find values, we always include the fields in the values array passed in because we want to find any field items to publish. This resulted in thefindValues
function setting therecord_id
for the first item for all fields regardless if any items were found. This resulted in publishing of incomplete items. They didn't seem to show up on the pages, but they were in the Drupal tables. This was fixed by adding a new function namedChadoStorage::isFieldValid()
that thefindValues()
uses to make sure a field has all of the required values before including it in what is returned. I also add ahas_values
to theChadoRecords
array that is set if thevalues
for the item are really set. This allows theisFieldValid()
to really be sure that an item has a set value or not (i.e. empty values are sometimes okay). Also, thefindValues()
function was presetting the IDs and Links on linked tables and it should not have been doing that.ChadoRecords::findRecords()
function was not looking at all of the ancialliary tables. There was a bug in that it exepcted that at least on of the columns in the linked table had to be used. This is the case in a property table where thevalue
column is used, but in the case of a linking table, we don't need any other columns but the IDs. So, once the problem in item 2 above was fixed, noproject_contact
records were being published at all. I fixed this so thefindRecords()
function now will go through all linked tables. This is fixed.TripalPublish::insertFieldItems()
had a bug in that it wasn't properly cycling through the entities correctly. This is fixed. I also fixed the way the number of published field items was reported.Testing?
insert into project_contact (project_id, contact_id) values (1,2), (1,3), (2,2), (2,3);
project
. It should add two contact items to each of the two project pages.