[report]: add daily report#2
Conversation
287accd to
5226297
Compare
5226297 to
c2bed4b
Compare
There was a problem hiding this comment.
Pull Request Overview
Adds a daily report feature to the Monobank Telegram bot that automatically generates and sends daily transaction statistics at scheduled times.
- Refactoring Monobank API client code with shared rate limiter and extracted common functionality
- Implementing scheduled daily reports with transaction filtering and summarization
- Adding new file serialization utilities for data persistence
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| schedule_report_data.go | Implements daily report data structure and transaction processing logic |
| schedule_report.go | Provides cron-based scheduling functionality for automated reports |
| mono.go | Extracts Monobank API operations with centralized rate limiting |
| template.go | Adds template for daily report messages |
| tools.go | Adds file serialization utilities and removes timezone dependency |
| client.go | Refactors to use shared Mono API client and removes rate limiting |
| bot.go | Integrates daily report functionality and extracts message sending utility |
| app.go | Initializes and starts scheduled reporting feature |
Comments suppressed due to low confidence (1)
schedule_report_data.go:1
- The expected timestamp 1703462400 for 'This week' test case appears incorrect. Based on the mocked time (Unix 1672531300 = Jan 1, 2023), the start of that week should be around 1672185600 (Dec 26, 2022), not 1703462400 (Dec 25, 2023).
package main
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return citem.CurrencyCodeA == item.CurrencyCode && citem.CurrencyCodeB == 980 | ||
| }) | ||
| if ok { | ||
| return -item.Amount * (currency.CurrencyCodeA * 100) |
There was a problem hiding this comment.
The calculation appears incorrect. currency.CurrencyCodeA represents a currency code (like 840 for USD), not an exchange rate. This should likely use currency.RateCross or another rate field.
| return -item.Amount * (currency.CurrencyCodeA * 100) | |
| return int(float64(-item.Amount) * currency.RateCross) |
|
|
||
| taskr := tasker.New(tasker.Option{ | ||
| Verbose: true, | ||
| Tz: "Europe/Kyiv", |
There was a problem hiding this comment.
The timezone should be 'Europe/Kiev' to match the IANA timezone database format, not 'Europe/Kyiv'.
| Tz: "Europe/Kyiv", | |
| Tz: "Europe/Kiev", |
No description provided.