Skip to content

fix:revenue numbers that look like they belong to another company - #145

Open
tomnotthomas wants to merge 7 commits into
Base360-AI:mainfrom
tomnotthomas:fix/assignment
Open

fix:revenue numbers that look like they belong to another company#145
tomnotthomas wants to merge 7 commits into
Base360-AI:mainfrom
tomnotthomas:fix/assignment

Conversation

@tomnotthomas

@tomnotthomas tomnotthomas commented Aug 7, 2026

Copy link
Copy Markdown
  1. Ocean Rentals saw another company's numbers. Two clients own a property with the same ID, and the cache didn't tell them apart.
  2. A booking made just after midnight in Paris was counted as February, because the month was measured in UTC. Months are now measured in the property's own timezone.
  3. Finance's missing cents. Amounts were converted to floating point on the way to the screen, which loses precision. They stay exact now.
  4. The dashboard was never reading the database. Fixed, and the hardcoded values removed.

tomnotthomas and others added 7 commits August 7, 2026 15:06
prop-001 exists under both tenants as two different buildings, so a
property-only key returned one client's total to the other. Key the
fallback by (tenant_id, property_id) and correct the figures to match
database/seed.sql.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
float() in the dashboard response cannot represent NUMERIC(10, 3)
totals exactly, and the frontend then scaled by 100 to round, losing
the stored sub-cent precision. The amount is now passed and rendered
as written, with no arithmetic on the way out.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Month boundaries were naive datetimes, so they were compared against
timestamptz check-ins as if they were UTC. A booking stored at
2024-02-29 23:30+00 is 1 March in Europe/Paris and was falling into
February, understating Sunset Properties' March by 1250.00.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three faults left session_factory as None on every request, so revenue
always fell back to hardcoded figures: initialize() read settings that
do not exist, QueuePool is not valid for an async engine, and an async
get_session cannot be used as a context manager.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Returning invented figures when the database is unreachable let a total
outage look like a working dashboard. The error now propagates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The function returned a hardcoded Decimal('0'), so the local-calendar
month boundaries were never applied to anything. It now reads the
property's timezone and sums reservations over that window.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tomnotthomas
tomnotthomas marked this pull request as ready for review August 7, 2026 14:23
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.

1 participant