Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2279 +/- ##
============================================
- Coverage 16.51% 16.49% -0.03%
Complexity 450 450
============================================
Files 254 254
Lines 7460 7470 +10
Branches 846 849 +3
============================================
Hits 1232 1232
- Misses 6163 6173 +10
Partials 65 65 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WalkthroughThe changes implement a uniqueness check for storybook titles during both manual and ePUB-based creation. If a duplicate title is detected, the process is halted, an error is shown, and a preview of the existing storybook is displayed. Supporting updates were made to the DAO, controllers, JSPs, and error messaging. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WebController
participant DAO
participant View
User->>WebController: Submit ePUB/storybook creation form
WebController->>DAO: readByTitle(title)
DAO-->>WebController: Existing storybook or null
alt Title exists
WebController->>View: Render form with error and existingStoryBook preview
else Title unique
WebController->>WebController: Proceed with ePUB processing (if applicable)
WebController->>DAO: Save new storybook
WebController->>View: Render success/redirect
end
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
src/main/webapp/WEB-INF/jsp/content/storybook/create-from-epub.jsp (1)
10-30: Fix potential null pointer exception in CSS class construction.Same issue as in
create.jsp- the code referencesexistingStoryBook.coverImage.checksumGitHubon line 20 outside the conditional check that verifies the cover image exists.Apply the same fix as suggested for the
create.jspfile.src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp (1)
24-44: Fix potential null pointer exception in CSS class construction.Same issue as in the other JSP files - line 34 references
existingStoryBook.coverImage.checksumGitHuboutside the conditional check that verifies the cover image exists.Apply the same fix pattern as suggested for the other JSP files.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
pom-dependency-tree.txt(1 hunks)src/main/java/ai/elimu/dao/jpa/StoryBookDaoJpa.java(1 hunks)src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java(1 hunks)src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java(1 hunks)src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java(1 hunks)src/main/webapp/WEB-INF/jsp/content/storybook/create-from-epub.jsp(1 hunks)src/main/webapp/WEB-INF/jsp/content/storybook/create.jsp(1 hunks)src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp(1 hunks)src/main/webapp/WEB-INF/tags/formErrors.tag(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: build (ubuntu-latest, 21)
- GitHub Check: test_rest
- GitHub Check: build (macos-latest, 21)
- GitHub Check: build (ubuntu-latest, 17)
- GitHub Check: test_rest
- GitHub Check: test_rest
- GitHub Check: build (windows-latest, 21)
- GitHub Check: build (windows-latest, 17)
- GitHub Check: build (macos-latest, 17)
- GitHub Check: test_rest
- GitHub Check: test_rest
- GitHub Check: test_rest
🔇 Additional comments (8)
pom-dependency-tree.txt (1)
1-1: Version bump looks good.The project version update to 2.6.76-SNAPSHOT is consistent with the feature changes being implemented across the codebase.
src/main/java/ai/elimu/dao/jpa/StoryBookDaoJpa.java (1)
22-22: ```shell
#!/bin/bashLocate the StoryBook entity and check for uniqueness on the title field
echo "Locating StoryBook entity..."
entity_file=$(fd -t f StoryBook.java)if [[ -z "$entity_file" ]]; then
echo "⚠️ StoryBook.java not found in the repository."
exit 1
fiecho "Found: $entity_file"
echo "Inspecting @column annotations for 'title'..."
rg -n "@column.*title" "$entity_file"</details> <details> <summary>src/main/webapp/WEB-INF/tags/formErrors.tag (1)</summary> `51-51`: **Good addition of generic NonUnique error handling.** The generic `'NonUnique'` error case provides appropriate fallback messaging for title uniqueness validation, consistent with the existing error message patterns. </details> <details> <summary>src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java (1)</summary> `71-71`: **Excellent enhancement for user experience.** Adding the existing storybook to the model when a duplicate is detected allows the UI to display helpful information about the conflicting entry, making it easier for users to understand and resolve the validation error. </details> <details> <summary>src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java (1)</summary> `152-152`: **Consistent implementation matching the create controller.** The addition of the existing storybook to the model follows the same pattern as the create controller, providing consistent user experience across both creation and editing workflows. </details> <details> <summary>src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java (3)</summary> `153-158`: **LGTM: Well-positioned uniqueness check with proper error handling.** The uniqueness check is correctly placed immediately after title extraction and before expensive processing operations. The error handling properly rejects the field and adds the existing storybook to the model for UI display. --- `160-221`: **LGTM: Smart optimization to prevent expensive operations on validation errors.** Wrapping the description extraction, cover image processing, and file operations in the error check prevents unnecessary processing when title uniqueness validation has already failed. This improves performance and user experience. --- `223-349`: **LGTM: Consistent error handling for chapter processing.** The second conditional check ensures that chapter extraction and processing only occur when there are no validation errors, maintaining consistency with the earlier processing logic. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Issue Number
Purpose
Technical Details
Testing Instructions
Screenshots
Format Checks
Note
Files in PRs are automatically checked for format violations with
mvn spotless:check.If this PR contains files with format violations, run
mvn spotless:applyto fix them.