-
-
Notifications
You must be signed in to change notification settings - Fork 236
feat(core, client, web): annual report #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…report management
…nual report execution
Summary of ChangesHello @luoling8192, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers a significant new feature: the Annual Report. Users can now generate a comprehensive overview of their messaging activity for any given year, presented in an easy-to-understand format. This enhancement provides valuable insights into user engagement and communication patterns, making the application more useful for personal data analysis. The implementation spans across the UI, core backend logic, and database, ensuring a robust and integrated experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new Annual Report feature, which is a great addition. The implementation is solid, with good backend logic for generating the report, including resumability for long-running tasks. The frontend part is also well-structured. I've identified a few areas for improvement, mainly concerning internationalization on the new page, database schema robustness, and a couple of minor logic enhancements in the backend. Overall, great work on this significant new feature.
| })) | ||
|
|
||
| if ((result instanceof Api.messages.MessagesSlice || result instanceof Api.messages.Messages) && 'count' in result) { | ||
| const count = result.count || result.messages.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to determine the message count result.count || result.messages.length could be incorrect. When using messages.Search with limit: 1, result.count holds the total number of matching messages, while result.messages.length will be at most 1. Using result.messages.length as a fallback will lead to an incorrect (much lower) total count for the plan. You should rely solely on result.count.
| const count = result.count || result.messages.length | |
| const count = result.count ?? 0 |
| class="w-full rounded-t-sm bg-primary/60 transition-all hover:bg-primary" | ||
| :style="{ height: `${(s.messageCount / (maxMonth?.messageCount || 1)) * 100}%` }" | ||
| > | ||
| <div class="absolute bottom-full mb-2 w-max rounded bg-black px-2 py-1 text-xs text-white hidden group-hover:block"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tooltip's background and text colors are hardcoded as bg-black and text-white. This will not adapt to theme changes (e.g., light/dark mode). It's better to use semantic color classes from your Tailwind theme to ensure consistency and proper display in all themes.
<div class="absolute bottom-full mb-2 w-max rounded bg-popover px-2 py-1 text-xs text-popover-foreground hidden group-hover:block">
| {{ chat.chatName }} | ||
| </div> | ||
| <div class="text-xs text-muted-foreground"> | ||
| ID: {{ chat.chatId }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{ chat.messageCount }} | ||
| </div> | ||
| <div class="text-xs text-muted-foreground"> | ||
| messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{ t('annualReport.selectYear') }} | ||
| </h2> | ||
| <p class="mt-1"> | ||
| Click generate to look back at your Telegram journey. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| stats.topChats = Object.entries(chatCounts) | ||
| .map(([id, data]) => ({ chatId: Number(id), chatName: data.name, messageCount: data.count })) | ||
| .sort((a, b) => b.messageCount - a.messageCount) | ||
| .slice(0, 20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number 20 is used here to limit the number of top chats. It's better to define this as a constant at the top of the file or in a shared constants file. This improves readability and makes it easier to change the value in the future.
| .slice(0, 20) | |
| .slice(0, 20) // TODO: Use a constant like TOP_CHATS_COUNT |
| totalCount: integer().default(0), | ||
| processedCount: integer().default(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The totalCount and processedCount columns have a default value but are nullable. It's safer to make them non-nullable by adding .notNull() to prevent any unexpected null values and ensure data integrity at the database level. The existing code already seems to treat them as non-nullable.
| totalCount: integer().default(0), | |
| processedCount: integer().default(0), | |
| totalCount: integer().notNull().default(0), | |
| processedCount: integer().notNull().default(0), |
No description provided.