From a5c7c3d6e3ee307b9b8315ac10e87ae3498e2c0d Mon Sep 17 00:00:00 2001 From: Cory Nathe Date: Tue, 16 Jun 2026 14:29:29 -0500 Subject: [PATCH] DisplayPeptideGroupInformationAction revert containerId check from previous PR (#269) #### Rationale Related PR made an update for a crawler issue but added an extra containerId check that doesn't apply in this case. Also convert one pepdb manager method to use SQLFragment. #### Related Pull Requests * https://github.com/LabKey/customModules/pull/212 --- pepdb/src/org/scharp/atlas/pepdb/PepDBController.java | 2 +- pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java | 10 ++++++---- .../org/labkey/test/tests/pepdb/PepDBModuleTest.java | 10 ++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pepdb/src/org/scharp/atlas/pepdb/PepDBController.java b/pepdb/src/org/scharp/atlas/pepdb/PepDBController.java index ea10af3b..106695d1 100644 --- a/pepdb/src/org/scharp/atlas/pepdb/PepDBController.java +++ b/pepdb/src/org/scharp/atlas/pepdb/PepDBController.java @@ -443,7 +443,7 @@ public ModelAndView getView(PeptideAndGroupForm form, BindException errors) thro pg = PepDBManager.getPeptideGroupByID(peptideGroupId); } catch (NumberFormatException ignored) {} - if (pg == null || !getContainer().getId().equalsIgnoreCase(pg.getContainerId())) + if (pg == null) { throw new NotFoundException(); } diff --git a/pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java b/pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java index 09d144b6..758c94ca 100644 --- a/pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java +++ b/pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java @@ -295,10 +295,12 @@ public static Peptides[] getParentPeptides(Peptides p) throws SQLException public static Peptides[] getHyphanatedParents(Peptides p) throws SQLException { - String sql = "select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? " + - " and peptides.peptide_sequence LIKE '%"+p.getPeptide_sequence()+"%' " + - " and child = false"; - Peptides[] peptides = new SqlSelector(schema.getSchema(), sql, new Object[]{p.getProtein_cat_id()}).getArray(Peptides.class); + // GitHub Kanban #1929: parameterize the LIKE clause for the stored peptide_sequence + SQLFragment sql = new SQLFragment("select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? ", p.getProtein_cat_id()); + sql.append(" and peptides.peptide_sequence LIKE ? "); + sql.add("%" + schema.getSchema().getSqlDialect().encodeLikeOpSearchString(p.getPeptide_sequence()) + "%"); + sql.append(" and child = false"); + Peptides[] peptides = new SqlSelector(schema.getSchema(), sql).getArray(Peptides.class); return peptides; } diff --git a/pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java b/pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java index dfe49252..6b613a0e 100644 --- a/pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java +++ b/pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java @@ -31,6 +31,7 @@ import org.labkey.test.TestTimeoutException; import org.labkey.test.WebTestHelper; import org.labkey.test.categories.CustomModules; +import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.LogMethod; import org.labkey.test.util.PostgresOnlyTest; @@ -180,6 +181,15 @@ public void testSteps() throws Exception clickAndWait(Locator.css("a.labkey-button > span")); + // Verify peptide group detail page + clickAndWait(Locator.linkWithText("List Peptide Groups")); + clickAndWait(Locator.linkWithText("gagptegprac")); + assertTextPresentInThisOrder( + "Group Information from peptide_group table for group : gagptegprac", + "There are (16) peptides in the 'gagptegprac' peptide group." + ); + DataRegionTable pepTable = new DataRegionTable("group_peptides", getDriver()); + assertEquals("Peptide table for group does not have expected number of rows", 16, pepTable.getDataRowCount()); /* *