Skip to content

Commit b41367c

Browse files
committed
coderabbitai II
1 parent 76367bb commit b41367c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,11 @@ public Map<Long, List<Long>> findReferencedPagesByItems(String siteId) {
856856
}
857857

858858
for (SimplePage page : allPages) {
859+
if ("0".equals(page.getToolId())) {
860+
log.debug("Skipping orphaned page {} with toolId='0'", page.getPageId());
861+
continue;
862+
}
863+
859864
List<SimplePageItem> items = simplePageToolDao.findItemsOnPage(page.getPageId());
860865
if (items != null) {
861866
for (SimplePageItem item : items) {

lessonbuilder/tool/src/test/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ public void testFindReferencedPagesByItemsSkipsOrphans() {
229229
// The method should skip orphaned parents
230230
Map<Long, List<Long>> result = producer.findReferencedPagesByItems(siteId);
231231

232-
// Result may be empty or not contain the orphan - depends on implementation
233-
// The key point is it shouldn't cause errors
232+
// Verify the orphan parent is not included in the result
234233
assertNotNull("Result should not be null", result);
234+
assertFalse("Orphan parent page 200L should not be in result", result.containsKey(200L));
235235
}
236236

237237
/**

0 commit comments

Comments
 (0)