Conversation
WalkthroughThe changes revise scheduled execution times for letter and sound usage count schedulers, refactor frequency calculation logic in letter, letter-sound, sound, and word usage count schedulers to simplify frequency accumulation and update usage counts directly by entity IDs, and correct a comment in the word list controller. No public API signatures were modified. Changes
Estimated code review effort3 (90–240 minutes) 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
✨ Finishing Touches
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java(1 hunks)src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java(1 hunks)src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java(2 hunks)src/main/java/ai/elimu/web/content/word/WordListController.java(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
src/main/java/ai/elimu/web/content/word/WordListController.java (2)
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java (1)
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java (1)
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
🔇 Additional comments (6)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
38-38: LGTM - Well-coordinated scheduling adjustmentThe schedule time change from 06:15 to 06:20 aligns well with the broader scheduling coordination across usage count tasks (Words at 06:00, Letter Sounds at 06:10, Letters at 06:20), which helps prevent resource contention and ensures proper execution order.
src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java (1)
28-28: LGTM - Coordinated scheduling improvementThe schedule time change from 06:15 to 06:10 is part of the well-planned scheduling coordination that sequences usage count calculations appropriately.
src/main/java/ai/elimu/web/content/word/WordListController.java (1)
53-53: LGTM - Accurate comment correctionThe comment correction from "letter frequency distribution" to "word frequency distribution" accurately reflects what the code actually does, improving documentation clarity.
src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java (3)
7-7: LGTM - Good simplification by removing unused importsThe removal of unused imports (StoryBook-related classes, Language, ConfigHelper, WordFrequencyHelper) reflects the cleaner refactored approach.
Also applies to: 13-13
18-18: LGTM - Accurate documentation updateThe comment correctly describes the new approach of iterating directly over storybook paragraphs rather than the previous hierarchical traversal.
52-55: LGTM - Simplified update logicThe direct update approach using the frequency map is much cleaner than the previous implementation, eliminating the need to re-fetch Word entities by text.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2305 +/- ##
============================================
- Coverage 16.56% 16.54% -0.02%
+ Complexity 455 452 -3
============================================
Files 258 258
Lines 7740 7687 -53
Branches 899 892 -7
============================================
- Hits 1282 1272 -10
+ Misses 6385 6341 -44
- Partials 73 74 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java(2 hunks)src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java(3 hunks)src/main/java/ai/elimu/tasks/SoundUsageCountScheduler.java(3 hunks)src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/main/java/ai/elimu/tasks/SoundUsageCountScheduler.java
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java
- src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: venkatesh2k3
PR: elimu-ai/webapp#1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the `LetterSoundContributionEventDao.java` file, the method signatures should use `LetterSoundContributionEvent` instead of `LetterSoundCorrespondenceContributionEvent` to maintain consistency with the renaming of entities.
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
🪛 GitHub Actions: Maven Build
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
🪛 GitHub Actions: Maven Regression Tests (eng.elimu.ai)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
🪛 GitHub Actions: Maven Regression Tests (tgl.elimu.ai)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
🪛 GitHub Actions: Maven Regression Tests (hin.elimu.ai)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
🪛 GitHub Actions: Maven Regression Tests (localhost)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
🪛 GitHub Actions: Maven Regression Tests (tha.elimu.ai)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java
[error] 61-61: Compilation error: incompatible types: java.lang.String cannot be converted to java.lang.Long
[error] 66-66: Compilation error: incompatible types: java.lang.Long cannot be converted to java.lang.String
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test_rest
🔇 Additional comments (1)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
37-37: Scheduling time adjustment looks goodThe cron expression and comment are correctly updated to reflect the new execution time.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (2)
35-37: UseMap#mergefor tighter countingYou can shave a few lines and avoid the explicit
getOrDefaultby relying onmerge:- frequencyMap.put(letter.getId(), frequencyMap.getOrDefault(letter.getId(), 0) + 1); + frequencyMap.merge(letter.getId(), 1, Integer::sum);Minor, but keeps the intent crystal-clear.
41-45: Avoid unnecessary DB writes
letterDao.update(letter)is executed for every Letter, even when theusageCounthasn’t changed.
That can trigger redundant UPDATEs, extra version bumps, and cache invalidations.for (Letter letter : letterDao.readAll()) { int newCount = frequencyMap.getOrDefault(letter.getId(), 0); if (letter.getUsageCount() != newCount) { letter.setUsageCount(newCount); letterDao.update(letter); } }Optionally wrap the loop in a single transaction or use a bulk update query for further savings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
pom-dependency-tree.txt(1 hunks)src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java(2 hunks)src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java(2 hunks)src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- pom-dependency-tree.txt
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java
- src/main/java/ai/elimu/tasks/LetterSoundUsageCountScheduler.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: venkatesh2k3
PR: elimu-ai/webapp#1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the `LetterSoundContributionEventDao.java` file, the method signatures should use `LetterSoundContributionEvent` instead of `LetterSoundCorrespondenceContributionEvent` to maintain consistency with the renaming of entities.
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: test_rest
- GitHub Check: test_rest
- GitHub Check: build (windows-latest, 21)
- GitHub Check: test_rest
- GitHub Check: build (windows-latest, 17)
- GitHub Check: build (ubuntu-latest, 17)
- GitHub Check: test_rest
- GitHub Check: test_rest
- GitHub Check: build (ubuntu-latest, 21)
- GitHub Check: test_rest
🔇 Additional comments (1)
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1)
31-32: Past type-mismatch fixed – looks goodSwitching the frequency map to
Map<Long, Integer>finally aligns the key type withletter.getId(), eliminating the compilation error noted in prior reviews.
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.