Public: anyone can read this; the crew can change it.

The samples include deals closed earlier this year, so the book line and the Closed list show a year of sales and commission earned instead of $0 #165

opened this

Merged 26d 2h ago, live in production

The seed now writes three sample deals that closed earlier this year, so the book line and the Closed list show a year of sales instead of $0. The full bun test run passes (552 tests). I couldn't type-check: the repo has no tsconfig.json, so bun x tsc --noEmit only prints its help.

Notes

opened this

The seed now writes three sample deals that closed earlier this year, so the book line and the Closed list show a year of sales instead of $0. The full bun test run passes (552 tests). I couldn't type-check: the repo has no tsconfig.json, so bun x tsc --noEmit only prints its help. scripts/gate.ts and scripts/fast.ts don't exist in this clone.

What changed

  • New samples in src/sample.ts: 35 Mill Pond Road ($465,000, 2.5%), 602 Cedar Heights Blvd (listing side, $612,000, 2.75%) and 14 Saltmarsh Lane ($298,000, 3%). Each has its parties and every date marked done. They closed about 75, 140 and 200 days ago.
  • Staying this year: a closing offset is capped at the days since 1 January. A database seeded in early January still counts them as this year (a test seeds on 5 January). refresh and restore need no change.
  • The book line now reads "4 open · … · 3 closed this year, $1,375,000 · $45,328 commission pending · $37,395 earned this year". src/book.ts is untouched.
  • Off the clock: the three are closed, so they stay out of the lanes, This week, reminders and the calendar. They show in the Closed list with their price.
  • No check-ins yet: the check-in from #139 is already on main. These samples are marked done yesterday, so it is not due for about 29 days. None of the three drafts one, and none is drafted on purpose.
  • Restore and remove: I didn't touch the restore or remove code. The new restore test checks that restore brings the closed samples back and leaves a real deal alone.
  • New tests in src/sample.test.ts:
    • The three are in the book with non-zero earned commission.
    • The open count stays at 4.
    • Their check-in drafts are not due today.
    • January placement.
    • Restore brings them back.
  • Docs: the README intro, the restore step and the book-line mention now say seven samples and describe the closed ones. The "four sample deals" wording is also updated in docs/TECHNICAL.md, src/actions.ts and src/mcp.ts.

Existing tests I edited (the tests were stale, not the code)

  • Deal-count assertions of 4 became 7.
  • Tests that took the first deal in the list now skip closed ones, because the list sorts by closing date and the closed samples come first.
  • The terminal Closed count and the book-line assertion changed to match.
  • The server test that expected no Closed card now checks that the card doesn't list that deal.

What I chose not to do

  • No sample uses a waived date. A waived date has done_at null, so several existing tests mistook such a deal for one with open dates. All three have every date done.
  • I didn't fix the done-yesterday timestamps the samples use for finished dates, since the issue says another issue covers that. Because of it the closed samples show "closed" on their closing date but their done-at is yesterday.

To try it: open / signed in and look at the book line and the Closed card. Then use Restore the sample deals (admin only) to see them come back.

Closes #158

2 earlier comments
commented

The seed now writes three sample deals that closed earlier this year, so the book line and the Closed list show a year of sales instead of $0. The full bun test run passes (552 tests). I couldn't type-check: the repo has no tsconfig.json, so bun x tsc --noEmit only prints its help. scripts/gate.ts and scripts/fast.ts don't exist in this clone.

What changed

  • New samples in src/sample.ts: 35 Mill Pond Road ($465,000, 2.5%), 602 Cedar Heights Blvd (listing side, $612,000, 2.75%) and 14 Saltmarsh Lane ($298,000, 3%). Each has its parties and every date marked done. They closed about 75, 140 and 200 days ago.
  • Staying this year: a closing offset is capped at the days since 1 January. A database seeded in early January still counts them as this year (a test seeds on 5 January). refresh and restore need no change.
  • The book line now reads "4 open · … · 3 closed this year, $1,375,000 · $45,328 commission pending · $37,395 earned this year". src/book.ts is untouched.
  • Off the clock: the three are closed, so they stay out of the lanes, This week, reminders and the calendar. They show in the Closed list with their price.
  • No check-ins yet: the check-in from #139 is already on main. These samples are marked done yesterday, so it is not due for about 29 days. None of the three drafts one, and none is drafted on purpose.
  • Restore and remove: I didn't touch the restore or remove code. The new restore test checks that restore brings the closed samples back and leaves a real deal alone.
  • New tests in src/sample.test.ts:
    • The three are in the book with non-zero earned commission.
    • The open count stays at 4.
    • Their check-in drafts are not due today.
    • January placement.
    • Restore brings them back.
  • Docs: the README intro, the restore step and the book-line mention now say seven samples and describe the closed ones. The "four sample deals" wording is also updated in docs/TECHNICAL.md, src/actions.ts and src/mcp.ts.

Existing tests I edited (the tests were stale, not the code)

  • Deal-count assertions of 4 became 7.
  • Tests that took the first deal in the list now skip closed ones, because the list sorts by closing date and the closed samples come first.
  • The terminal Closed count and the book-line assertion changed to match.
  • The server test that expected no Closed card now checks that the card doesn't list that deal.

What I chose not to do

  • No sample uses a waived date. A waived date has done_at null, so several existing tests mistook such a deal for one with open dates. All three have every date done.
  • I didn't fix the done-yesterday timestamps the samples use for finished dates, since the issue says another issue covers that. Because of it the closed samples show "closed" on their closing date but their done-at is yesterday.

To try it: open / signed in and look at the book line and the Closed card. Then use Restore the sample deals (admin only) to see them come back.

commented

I merged main into the branch, fixed the one conflict in src/sample.test.ts, and pushed. The full bun test run passes (554 tests). I didn't run tsc because the repo has no tsconfig.json.

  • The conflict: both sides added to src/sample.test.ts. I kept my closed-sample tests and main's new test that no finished sample date reads late. That test relies on main's change that stamps finished dates before their due day. The merge also left a missing });, which I restored.
  • Closing dates moved: Mill Pond Road now closes 21 days ago and Cedar Heights 9 days ago. Saltmarsh Lane is unchanged at 200 days ago. The book totals are the same ($1,375,000 volume, 3 closed this year).
  • Check-in claim corrected: my earlier description was wrong on one point. None of the three closed samples drafts a check-in, because the sample buyers and sellers have no contact details. That holds whatever their dates are. The test now asserts they draft nothing.
commented

Both of sentinel's points are fixed and pushed to #165. The full bun test run passes (556 tests). I did not run tsc, because the repo has no tsconfig.json.

Box 4 tests

  • Off the clock: a new test in src/sample.test.ts renders the clock page. It checks that each closed sample is in the Closed list with its price and absent from the rest of the page. It also checks that none appear in This week, in People's open dates, or in the calendar file. The same page rendered with the closed deals left open shows the address, so the checks fail if a closed deal were left open.
  • Refresh keeps them in the year: a second new test covers this, and it found a real bug. refresh shifts a closed sample's closing date by the elapsed days. A database seeded on 20 December and refreshed on 10 January would have pushed the closings into the previous year and dropped them from "closed this year". Without the fix, that test fails.

refresh change: I changed refresh after all, contrary to my earlier note that it needed none. A closed sample that would land before 1 January is now moved to 1 January, with all its dates shifted together.

Box 5 docs: the README intro is now short sentences: seven deals, four open, three closed. It gives the book-line example in the usual shape. The src/sample.ts row in the docs/TECHNICAL.md table is re-padded.

For the pull description: in src/server.test.ts I weakened one assertion. After a deal is reopened, the test used to say there is no Closed card. It now checks that the Closed list doesn't contain that deal's address, because the closed samples keep the card on the page. The same change applies to src/terminal.test.ts. Its Closed (n) counts moved from 0 and 1 to 3 and 4, and "no Closed section" became "this deal's closed line is absent".

I don't disagree with anything in the review.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs