elimu-ai / webapp

🖥 Web application for hosting Android applications and educational content
https://hin.elimu.ai
MIT License
30 stars 55 forks source link

1678 Rename from time to timestamp in the database #1738

Closed alexander-kuruvilla closed 1 month ago

alexander-kuruvilla commented 1 month ago

Closes #1678

Changes: Updated the name of objects name time to timestamp. Updated setTime() to setTimestamp(). Updated getTime() to getTimestamp(). Updated references to getters and setters in the code.

coderabbitai[bot] commented 1 month ago

Walkthrough

The changes involve renaming the time variable and associated methods to timestamp across various Java classes and JSP files in the repository. This update ensures consistency in naming conventions for handling timestamps. Additionally, database schema migrations were applied to rename the time column to timestamp across multiple tables, standardizing the timestamp column names.

Changes

Files/Directories Change Summaries
src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java Renamed time variable and setTime method to timestamp and setTimestamp respectively in StoryBookLearningEvent class.
src/main/java/ai/elimu/web/content/peer_review/... Updated handleSubmit methods to use setTimestamp instead of setTime for various peer review event controllers (AudioPeerReviewEventCreateController, LetterSoundPeerReviewEventCreateController, NumberPeerReviewEventCreateController, StoryBookPeerReviewEventCreateController, WordPeerReviewEventCreateController).
src/main/resources/db/migration/2004014.sql Introduced database migrations to rename time columns to timestamp and change data type to DATETIME across multiple tables.
src/main/webapp/WEB-INF/jsp/content/contributor/... Updated timestamp formatting from time to timestamp for different contribution events (contributor-numbers.jsp, contributor-storybooks.jsp, contributor-words.jsp).
src/main/webapp/WEB-INF/jsp/content/letter-sound/... Changed timestamp variable from time to timestamp in JSP files related to letter sound contribution and peer review events (edit.jsp, peer-reviews/pending.jsp).
src/main/webapp/WEB-INF/jsp/content/letter/... Updated date formatting for letterContributionEvent and letterPeerReviewEvent by changing the variable from time to timestamp in edit.jsp.
src/main/webapp/WEB-INF/jsp/content/multimedia/... Renamed time to timestamp for date formatting in JSP files related to multimedia events (audio/edit.jsp, image/edit.jsp).
src/main/webapp/WEB-INF/jsp/content/number/... Updated timestamp variable from time to timestamp in JSP files related to number contribution and peer review events (edit.jsp, peer-reviews/pending.jsp).
src/main/webapp/WEB-INF/jsp/content/sound/edit.jsp Changed date formatting variables from time to timestamp for sound contribution and peer review events.
src/main/webapp/WEB-INF/jsp/content/storybook/... Modified timestamp variable from time to timestamp in JSP files for storybook events (edit.jsp, peer-reviews/pending.jsp).
src/main/webapp/WEB-INF/jsp/content/word/... Updated date formatting from time to timestamp for word contribution and peer review events (edit.jsp, peer-reviews/pending.jsp).

Assessment against linked issues

Objective Addressed Explanation
Rename from time to timestamp in the database (#1678)

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between e1b2b687bdcbc2a0cbf6d12104fa11992bdfa9f4 and e67025988cf55cec56891bef738799e8ef7ddfeb.
Files selected for processing (15) * src/main/webapp/WEB-INF/jsp/content/contributor/contributor-numbers.jsp (3 hunks) * src/main/webapp/WEB-INF/jsp/content/contributor/contributor-storybooks.jsp (3 hunks) * src/main/webapp/WEB-INF/jsp/content/contributor/contributor-words.jsp (3 hunks) * src/main/webapp/WEB-INF/jsp/content/letter-sound/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/letter-sound/peer-reviews/pending.jsp (1 hunks) * src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/multimedia/audio/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp (1 hunks) * src/main/webapp/WEB-INF/jsp/content/number/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/number/peer-reviews/pending.jsp (1 hunks) * src/main/webapp/WEB-INF/jsp/content/sound/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/storybook/peer-reviews/pending.jsp (1 hunks) * src/main/webapp/WEB-INF/jsp/content/word/edit.jsp (2 hunks) * src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp (1 hunks)
Files skipped from review due to trivial changes (1) * src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp
Additional comments not posted (22)
src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp (1)
`68-68`: **Correct update of timestamp variable.** The change from `${wordContributionEvent.time.time}` to `${wordContributionEvent.timestamp.time}` correctly reflects the database and variable renaming. Ensure that the timestamp is displayed correctly in the UI.
src/main/webapp/WEB-INF/jsp/content/letter-sound/peer-reviews/pending.jsp (1)
`68-68`: **Correct update of timestamp variable.** The update from `${letterSoundContributionEvent.time.time}` to `${letterSoundContributionEvent.timestamp.time}` is consistent with the renaming in the database schema. Verify that the displayed format "yyyy-MM-dd HH:mm" is suitable for the application's requirements.
src/main/webapp/WEB-INF/jsp/content/number/peer-reviews/pending.jsp (1)
`77-77`: **Correct update of timestamp variable.** The change from `${numberContributionEvent.time.time}` to `${numberContributionEvent.timestamp.time}` aligns with the renaming efforts. Confirm that the timestamp is displayed correctly and that the format "yyyy-MM-dd HH:mm" meets the application's display requirements.
src/main/webapp/WEB-INF/jsp/content/storybook/peer-reviews/pending.jsp (1)
`83-83`: **Correct update of timestamp variable.** The update from `${storyBookContributionEvent.time.time}` to `${storyBookContributionEvent.timestamp.time}` aligns with the renaming efforts. Verify that the timestamp is displayed correctly and that the format "yyyy-MM-dd HH:mm" meets the application's display requirements.
src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp (2)
`74-74`: **Updated date formatting to use `timestamp`.** The change from `time` to `timestamp` in the `fmt:formatDate` function call aligns with the PR's objective and is correctly implemented here. --- `145-145`: **Updated date formatting to use `timestamp` in peer review events.** This update is consistent with the changes made throughout the file and correctly uses the new `timestamp` field.
src/main/webapp/WEB-INF/jsp/content/contributor/contributor-numbers.jsp (3)
`34-34`: **Timestamp variable update in date formatting is correct.** The change from `time.time` to `timestamp.time` correctly reflects the PR's objective to standardize timestamp handling. This should ensure the correct display of the timestamp in the UI. --- `81-81`: **Consistent update for peer review timestamp display.** This update is consistent with the changes made elsewhere in the file, ensuring that all references to the old `time` variable are updated to `timestamp`. Good attention to detail. --- `155-155`: **Proper implementation of timestamp in peer review section.** The update from `time.time` to `timestamp.time` is implemented correctly here as well. This ensures that the display of dates in the peer review section is accurate and consistent with the rest of the application.
src/main/webapp/WEB-INF/jsp/content/number/edit.jsp (2)
`182-182`: **Correct update of timestamp usage in contribution events.** The change from `time.time` to `timestamp.time` in the date formatting tag is correct and aligns with the PR's objectives. This should ensure the accurate display of timestamps in the contribution events section. --- `253-253`: **Properly updated timestamp formatting in peer review events.** The update to use the `timestamp` variable for date formatting in peer review events is correctly implemented. This change maintains consistency across the application.
src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp (1)
`116-116`: **Timestamp update in image contribution events is correct.** The renaming of `time` to `timestamp` in the date formatting tag is implemented correctly. This ensures that the timestamp is displayed accurately in image contribution events.
src/main/webapp/WEB-INF/jsp/content/letter-sound/edit.jsp (2)
`213-213`: **Correct implementation of timestamp in letter sound contribution events.** The change from `time.time` to `timestamp.time` is correctly implemented, ensuring that the timestamp is displayed accurately in letter sound contribution events. --- `284-284`: **Consistent timestamp formatting in peer review events for letter sounds.** The update to use the `timestamp` variable for date formatting in peer review events is correctly implemented, maintaining consistency and accuracy in the display of timestamps.
src/main/webapp/WEB-INF/jsp/content/multimedia/audio/edit.jsp (2)
`193-193`: **Updated Timestamp Formatting** The update from `time` to `timestamp` here is consistent with the PR's objective to standardize timestamp handling. The formatting string is correctly maintained. --- `264-264`: **Updated Timestamp Formatting in Peer Review Section** This change correctly updates the timestamp formatting for peer review events, aligning with the PR's objectives. The use of the `timestamp` field and the date formatting pattern are correctly applied.
src/main/webapp/WEB-INF/jsp/content/word/edit.jsp (1)
`311-311`: **Updated Timestamp Formatting in Peer Review Section for Words** This update correctly applies the new `timestamp` field for formatting dates in the peer review section for words. The consistency in date formatting ensures that the display remains accurate and clear.
src/main/webapp/WEB-INF/jsp/content/sound/edit.jsp (2)
`78-78`: **Updated variable name from `time` to `timestamp`.** The change from `${soundContributionEvent.time.time}` to `${soundContributionEvent.timestamp.time}` is consistent with the PR objectives to standardize timestamp naming. This should help avoid confusion in the codebase. --- `149-149`: **Updated variable name from `time` to `timestamp`.** The change from `${soundPeerReviewEvent.time.time}` to `${soundPeerReviewEvent.timestamp.time}` is correctly implemented and aligns with the PR's goal of renaming `time` to `timestamp` to enhance clarity.
src/main/webapp/WEB-INF/jsp/content/contributor/contributor-words.jsp (2)
`30-30`: **Updated variable name from `time` to `timestamp`.** The change from `${wordContributionEvent.time.time}` to `${wordContributionEvent.timestamp.time}` is correctly implemented. This update is part of the effort to standardize the handling of timestamps across the application. --- `77-77`: **Updated variable name from `time` to `timestamp`.** The changes from `${wordPeerReviewEvent.time.time}` to `${wordPeerReviewEvent.timestamp.time}` are correctly implemented across multiple instances in the file. This ensures consistency in how timestamps are handled and displayed. Also applies to: 151-151
src/main/webapp/WEB-INF/jsp/content/contributor/contributor-storybooks.jsp (1)
`32-32`: **Updated variable name from `time` to `timestamp`.** The changes from `${storyBookContributionEvent.time.time}` and `${storyBookPeerReviewEvent.time.time}` to `${storyBookContributionEvent.timestamp.time}` and `${storyBookPeerReviewEvent.timestamp.time}` are correctly implemented. These updates are part of the effort to standardize the handling of timestamps across the application, enhancing clarity and consistency. Also applies to: 79-79, 153-153
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 4.91803% with 58 lines in your changes missing coverage. Please review.

Project coverage is 15.26%. Comparing base (db733c0) to head (e670259).

Files Patch % Lines
...n/java/ai/elimu/util/db/DbContentImportHelper.java 0.00% 5 Missing :warning:
.../analytics/LetterLearningEventsRestController.java 0.00% 4 Missing :warning:
...alytics/StoryBookLearningEventsRestController.java 0.00% 4 Missing :warning:
...v2/analytics/WordLearningEventsRestController.java 0.00% 4 Missing :warning:
...i/elimu/util/csv/CsvAnalyticsExtractionHelper.java 0.00% 3 Missing :warning:
...va/ai/elimu/dao/jpa/LetterLearningEventDaoJpa.java 0.00% 2 Missing :warning:
...ai/elimu/dao/jpa/StoryBookLearningEventDaoJpa.java 0.00% 2 Missing :warning:
...java/ai/elimu/dao/jpa/WordLearningEventDaoJpa.java 0.00% 2 Missing :warning:
...n/java/ai/elimu/model/analytics/LearningEvent.java 0.00% 2 Missing :warning:
...va/ai/elimu/model/contributor/PeerReviewEvent.java 0.00% 2 Missing :warning:
... and 27 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1738 +/- ## ========================================= Coverage 15.26% 15.26% Complexity 450 450 ========================================= Files 248 248 Lines 7584 7584 Branches 799 799 ========================================= Hits 1158 1158 Misses 6376 6376 Partials 50 50 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alexander-kuruvilla commented 1 month ago

@jo-elimu thanks for your guidance and input, I will work on those.

alexander-kuruvilla commented 1 month ago

@alexander-kuruvilla The changes need to be reflected in the frontend files as well. For example the WEB-INF/jsp/content/letter/edit.jsp:

Caused by: javax.el.PropertyNotFoundException: Property [time] not found on type [ai.elimu.model.contributor.LetterContributionEvent]
    at javax.el.BeanELResolver$BeanProperties.get (BeanELResolver.java:253)
    at javax.el.BeanELResolver$BeanProperties.access$300 (BeanELResolver.java:206)
    at javax.el.BeanELResolver.property (BeanELResolver.java:322)
    at javax.el.BeanELResolver.getValue (BeanELResolver.java:93)
    at org.apache.jasper.el.JasperELResolver.getValue (JasperELResolver.java:125)
    at org.apache.el.parser.AstValue.getValue (AstValue.java:168)
    at org.apache.el.ValueExpressionImpl.getValue (ValueExpressionImpl.java:189)
    at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate (PageContextImpl.java:690)
    at org.apache.jsp.WEB_002dINF.jsp.content.letter.edit_jsp._jspx_meth_fmt_005fformatDate_005f0 (edit_jsp.java:1411)
    at org.apache.jsp.WEB_002dINF.jsp.content.letter.edit_jsp._jspx_meth_c_005fforEach_005f0 (edit_jsp.java:1305)
    at org.apache.jsp.WEB_002dINF.jsp.content.letter.edit_jsp._jspx_meth_content_005fsection_005f0 (edit_jsp.java:365)
    at org.apache.jsp.WEB_002dINF.jsp.content.letter.edit_jsp._jspService (edit_jsp.java:227)

-->

Tip

For a quick sign-on during localhost development, use this URL: http://localhost:8080/webapp/sign-on/test/role-CONTRIBUTOR

Got it. I wasn't able to check out the frontend, thanks for that tip. I'll update the jsps and go over the pages. Thanks.

Also I wanted to run something by you regarding coderabbitai's query optimisation suggestion, should I make the changes along with this or does that have to be another issue?

jo-elimu commented 1 month ago

Also I wanted to run something by you regarding coderabbitai's query optimisation suggestion, should I make the changes along with this or does that have to be another issue?

@alexander-kuruvilla The CodeRabbit suggestion seems reasonable, but is out of scope for this PR. So yes, feel to create a new issue for addressing that separately 👍