Skip to content

GitHub Issue #688: Sample's Created By and Modified By fields do not resolve correctly when added to assay results grid if sample lookup is set to a specific sample type #7564

Open
cnathe wants to merge 6 commits intodevelopfrom
fb_sampleLookup688
Open

Conversation

@cnathe
Copy link
Copy Markdown
Contributor

@cnathe cnathe commented Apr 8, 2026

Rationale

#688 Sample's Created By and Modified By fields do not resolve correctly when added to assay results grid if sample lookup is set to a specific sample type

This PR fixes GitHub issue #688 where CreatedBy and ModifiedBy fields fail to resolve when navigating through a sample lookup field (in an assay results grid) that targets a specific sample type. The fix replaces a
custom createLookupTableInfo() implementation — which manually called createMaterialTable() + populate() + overlayMetadata() — with a simpler delegation to getTable(tableName, cf), which goes through the schema's full
table construction pipeline and correctly sets up all FK columns including CreatedBy/ModifiedBy.

Changes

  • use schema getTable() for materialIdForeignKey instead of custom createLookupTableInfo()
  • add test case to AssayTest

@cnathe cnathe self-assigned this Apr 8, 2026
ret.setLocked(true);
return ret;

return getTable(tableName, getLookupContainerFilter());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Claude code is telling me that I need to protect against the case where st == null here for the "all samples" lookup, in which case the tableName is being set to "Materials" at line 248. So I plan to revert the previous code and instead conditionally return this new getTable(...) when st != null, unless you can see what we would never get into that st == null case here (which I don't think we can).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: the comment is a little odd now that I reverted things, but I put back in the part about using the createMaterialTable() for the "Materials" case.

if (st != null)
return getTable(tableName, getLookupContainerFilter());

ExpMaterialTable ret = ExperimentService.get().createMaterialTable(SamplesSchema.this, getLookupContainerFilter(), st);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't explore why the lookups were set up correctly for the all samples case, but I assume with your edits that this still works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct. with my edit, the All Samples lookup still works as expected. I believe it is because in ExpSchema.getMaterialIdForeignKey() the all samples case uses getTable() for the ExpSchema instead of calling the code here in SamplesSchema.materialIdForeignKey

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