Closed SnehaHS65 closed 1 month ago
The overall change involves renaming the LetterSoundCorrespondence
entity to LetterSound
throughout the codebase, updating class names, method signatures, imports, variable names, and references in both Java files and JSP files. Additionally, new classes and methods have been introduced to manage the updated entity effectively, alongside the creation of a scheduled task to track LetterSound
usage counts.
File Path | Change Summary |
---|---|
src/main/java/.../LetterSoundContributionEventDao.java , .../LetterSoundPeerReviewEventDao.java |
Updated import statements and method signatures to use LetterSound instead of LetterSoundCorrespondence . |
src/main/java/.../LetterSoundDao.java , .../LetterSoundDaoJpa.java |
Changed the entity type from LetterSoundCorrespondence to LetterSound and adjusted method implementations accordingly. |
src/main/java/.../LetterSoundContributionEventDaoJpa.java , .../LetterSoundDaoJpa.java |
Changed class imports and method parameter types from LetterSoundCorrespondence to LetterSound . |
src/main/java/.../converters/StringToLetterSoundConverter.java |
New file introducing a converter class to convert String IDs to LetterSound entities using LetterSoundDao . |
src/main/java/.../LetterSound.java , src/main/java/.../Word.java |
Renamed LetterSoundCorrespondence class to LetterSound and updated related fields and methods. |
src/main/java/.../LetterSoundContributionEvent.java , .../LetterSoundPeerReviewEvent.java |
Updated class imports and property types from LetterSoundCorrespondence to LetterSound . |
src/main/java/.../JpaToGsonConverter.java , .../LetterSoundsRestController.java |
Updated method signatures and object references to replace LetterSoundCorrespondence with LetterSound . |
src/main/java/.../LetterSoundUsageCountScheduler.java , .../SoundUsageCountScheduler.java |
Introduced a new scheduled task for LetterSound usage counts and updated references from LetterSoundCorrespondence to LetterSound in the existing scheduler. |
src/main/java/.../CsvContentExtractionHelper.java , .../DbContentImportHelper.java |
Renamed methods and data structures to handle LetterSound instead of LetterSoundCorrespondence . |
src/main/java/.../MainContentController.java , .../LetterSoundCreateController.java |
Changed attribute names and method parameters to use LetterSound instead of LetterSoundCorrespondence . |
src/main/java/.../LetterSoundEditController.java , .../LetterSoundListController.java |
Updated import statements, variable declarations, and method parameters to reference LetterSound . |
src/main/webapp/.../create.jsp , .../edit.jsp |
Updated modelAttribute values and element IDs from letterSoundCorrespondence to letterSound . |
src/test/java/.../WordContributionRestControllerTest.java |
Renamed test method and updated variable names and JSON object references to work with letterSounds instead of letterSoundCorrespondences . |
sequenceDiagram
participant User
participant LetterSoundUsageCountScheduler
participant WordDao
participant LetterSoundDao
User->>LetterSoundUsageCountScheduler: Trigger usage count update
LetterSoundUsageCountScheduler->>WordDao: Retrieve all Words
WordDao-->>LetterSoundUsageCountScheduler: Return Word list
LetterSoundUsageCountScheduler->>LetterSoundDao: Retrieve all LetterSounds
LetterSoundDao-->>LetterSoundUsageCountScheduler: Return LetterSound list
LetterSoundUsageCountScheduler->>LetterSoundDao: Update usage counts
LetterSoundDao-->>LetterSoundUsageCountScheduler: Confirm update
LetterSoundUsageCountScheduler-->>User: Usage counts updated
Objective | Addressed | Explanation |
---|---|---|
Rename LetterSoundCorrespondence to LetterSound (1677) |
✅ | |
Update references in LetterSoundPeerReviewEvent (1677) |
✅ | |
Update references in LetterSoundContributionEvent (1677) |
✅ | |
Update Word to use LetterSound instead of LetterSoundCorrespondence (1677) |
✅ | |
Ensure all usages reflect new class naming (1677) | ❌ | Some references may still exist in tests. |
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/resources/db/migration/2004022.sql (6)
`7-8`: **Ensure the table renaming is correct for `LetterSound_Letter`.** The command drops the `LetterSound_Letter` table if it exists and then renames `LetterSoundCorrespondence_Letter` to `LetterSound_Letter`. Ensure that this operation does not lead to data loss and that it is executed in the correct order. --- `19-20`: **Ensure column renaming is correct for `LetterSound_Sound`.** The command drops the `LetterSound_id` column and renames `LetterSoundCorrespondence_id` to `LetterSound_id` in the `LetterSound_Sound` table. Ensure that this operation does not lead to data loss and that it is executed in the correct order. --- `4-5`: **Ensure the table renaming is correct.** The command drops the `LetterSound` table if it exists and then renames `LetterSoundCorrespondence` to `LetterSound`. Ensure that this operation does not lead to data loss and that it is executed in the correct order.Verification successful
--- **Renaming of `LetterSoundCorrespondence` table is correct** The sequence of operations involving the `LetterSoundCorrespondence` table confirms that the table exists and is being manipulated correctly. The renaming operation to `LetterSound` is executed in the correct order and does not lead to data loss. - `src/main/resources/db/migration/2004022.sql`: `ALTER TABLE LetterSoundCorrespondence RENAME TO LetterSound;`--- `10-11`: **Ensure the table renaming is correct for `LetterSound_Sound`.** The command drops the `LetterSound_Sound` table if it exists and then renames `LetterSoundCorrespondence_Sound` to `LetterSound_Sound`. Ensure that this operation does not lead to data loss and that it is executed in the correct order. --- `13-14`: **Ensure the table renaming is correct for `Word_LetterSound`.** The command drops the `Word_LetterSound` table if it exists and then renames `Word_LetterSoundCorrespondence` to `Word_LetterSound`. Ensure that this operation does not lead to data loss and that it is executed in the correct order. --- `16-17`: **Ensure column renaming is correct for `LetterSound_Letter`.** The command drops the `LetterSound_id` column and renames `LetterSoundCorrespondence_id` to `LetterSound_id` in the `LetterSound_Letter` table. Ensure that this operation does not lead to data loss and that it is executed in the correct order.Scripts executed
The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify the existence of the `LetterSoundCorrespondence` table before renaming. # Test: Search for the `LetterSoundCorrespondence` table. Expect: The table should exist before renaming. rg --type sql -A 5 $'CREATE TABLE `LetterSoundCorrespondence`' ``` Length of output: 63 --- Script: ```shell #!/bin/bash # Description: Verify the existence of the `LetterSoundCorrespondence` table before renaming by searching for any references to it. # Test: Search for any references to the `LetterSoundCorrespondence` table in SQL files. rg --type sql 'LetterSoundCorrespondence' ``` Length of output: 5786 --- Script: ```shell #!/bin/bash # Description: List all SQL migration files and their contents to verify the sequence of operations involving `LetterSoundCorrespondence`. # Test: List the contents of all SQL migration files. fd -e sql -x cat ``` Length of output: 63280
Attention: Patch coverage is 5.26316%
with 108 lines
in your changes missing coverage. Please review.
Project coverage is 15.19%. Comparing base (
eb26209
) to head (cc010be
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The version of webapp in pom.xml is still 2.4.11 and the db migration script in this name already exists. If you could change the version, I can create db script.
@Sneha65 Done: https://github.com/elimu-ai/webapp/releases
@jo-elimu , can you please review and approve my PR
@SnehaHS65 I applied some suggestions: https://github.com/elimu-ai/webapp/pull/1725/commits/40cf0e155b6925b14c548688e513dc9bffaa71f9
So please fetch the latest changes before you continue working on the branch.
@SnehaHS65 I applied some suggestions: 40cf0e1
So please fetch the latest changes before you continue working on the branch.
@jo-elimu , Can you please check now?
@SnehaHS65 See https://github.com/elimu-ai/webapp/pull/1725/files#r1678766292
@jo-elimu , when I fetched from main and merged, it says already up to date that's why I pushed. I don't know why this is happening.
@SnehaHS65 See https://github.com/elimu-ai/webapp/pull/1725/files#r1678766292
@jo-elimu , when I fetched from main and merged, it says already up to date that's why I pushed. I don't know why this is happening.
@jo-elimu , the db script file for version 14 is also changed in main, now what would be the suitable thing to do? should I close this PR?
the db script file for version 14 is also changed in main, now what would be the suitable thing to do? should I close this PR?
@SnehaHS65 You can rename the file so that it matches the current snapshot version on the main
branch: https://github.com/elimu-ai/webapp/blob/main/pom.xml
@jo-elimu , now all the files should be in sync with the Main branch, can you please review
@jo-elimu , now all the files should be in sync with the Main branch, can you please review
Thank you, @SnehaHS65. I will test your code changes later today.
Thank you, @SnehaHS65. I think these changes look good. Please merge, so that we can create a release and try out the migration script on the databases in production (Hindi + Tagalog).
@jo-elimu , Merged!!
closes #1677
The version of webapp in pom.xml is still 2.4.11 and the db migration script in this name already exists. If you could change the version, I can create db script.