Skip to content

Forecast - #10

Merged
Salmamohamedd merged 14 commits into
devfrom
forecast
Jun 30, 2026
Merged

Salmamohamedd merged 14 commits into
devfrom
forecast

Conversation

@Salmamohamedd

Copy link
Copy Markdown
Contributor

No description provided.

Salmamohamedd and others added 3 commits June 28, 2026 20:40
Allow `get_combined_stats` to use an injected `now` value, fetch transactions through the last completed bucket, and compute top-category spending from both the current and preceding periods correctly. Updated tests to match the new time window and percentage-change behavior.
Update spendoo/statistics/service.py to set curr_end = now (instead of _get_next_bucket_start) and last_completed_end = min(end_date, now) (instead of _get_next_bucket_start). This prevents end boundaries from being advanced to the next bucket (which can be in the future) and ensures in-progress and last-completed buckets do not extend past the current time.
Joseph-Sameh-0 and others added 3 commits June 29, 2026 13:41
When summing empty sequences of Decimal values, the sum() function returns an integer 0 instead of a Decimal type, causing type mismatch issues. Added Decimal("0.00") as the start value to sum() calls to ensure consistent Decimal return types.

Also added a test to verify calculate_combined_stats handles empty transactions correctly.
Budget status bucket generation now stops at the provided `now` (or the current time) so future periods are excluded from status calculations. Added coverage for budget status and combined stats to verify the cutoff behavior.
Rename CombinedForecastBucketDto.predicted_status -> status and update ForecastService to rely on StatisticsService helpers for bucket boundaries. History/future date computation and horizon calculation were reorganized, calculate_combined_stats now receives now, and predicted bucket status is derived via stats_service._determine_budget_status. Removed the local _get_last_completed_bucket_start helper and cleaned up forecasting steps and minor formatting.
Joseph-Sameh-0 and others added 2 commits July 1, 2026 01:59
Split the combined forecast into nested financial stats, budget status, and top categories responses. Also updated forecast service return paths to populate the new response structure consistently when forecasting succeeds or falls back to historical data.

Co-Authored-By: Salmamohamedd <125445879+Salmamohamedd@users.noreply.github.com>
@Salmamohamedd
Salmamohamedd merged commit 0f86f2f into dev Jun 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants