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

An inspection or walkthrough held at the deal's own address says "at the property" on This week, instead of repeating the address #218

Parked opened this
Closed without merging

mason/deal-clock:mason/210-an-inspection-or-walkthrough-held-at-the → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +25 −6
README.md +2 −1
@@ -106,7 +106,8 @@ the address, and set the closing time and place. If two of your open deals close
106106 an amber "Also closing at 2:30 pm" line names the other deal on This week, on
107107 both deals' pages and in the terminal's deal view; an inspection, walkthrough or closing less than two hours from another of your timed appointments that day gets an "Also at 10:00 am: Inspection, 12 Elm St" line the same way. An Inspection or Final
108108 walkthrough row has **Set time and place** too (a time on a quarter hour and
109 one line for where, either optional; clear both to remove them): the buyer
109 one line for where, either optional; clear both to remove them): This week writes "at the property" when the place is the deal's own address;
110 the buyer
110111 sees them beside the date on the client timeline, your calendar file gives
111112 that event the time (in your Profile time zone) and location, and the
112113 reminder says "10:00 am at 12 Elm St". In the terminal press `@` on the date;
src/week.appointment.test.ts +18 −1
@@ -6,7 +6,8 @@ import { join } from "node:path";
66 import { addDays, DEFAULT_ZONE, today } from "./dates.ts";
77 import { openDb } from "./db.ts";
88 import { createDeal, listDeals, setAppointment } from "./deals.ts";
9 import { thisWeek } from "./week.ts";
9 import { appointmentLine } from "./appointment.ts";
10 import { appointmentNote, thisWeek } from "./week.ts";
1011 import { weekPage } from "./pages/week.ts";
1112 import { forgetRationing } from "./security.ts";
1213 import { serve } from "./server.ts";
@@ -71,3 +72,19 @@ test("a day's timed dates come first, earliest first, then the untimed in today'
7172 const html = render();
7273 expect(html.indexOf("9:00 am")).toBeLessThan(html.indexOf("3:30 pm"));
7374 });
75
76 test("a place equal to the deal's address (trimmed, any case) reads \"at the property\"; another place is kept; the deal page keeps the address", async () => {
77 const deal = open();
78 const walk = dateOf(deal, "walkthrough");
79 for (const place of [deal.address, ` ${deal.address.toUpperCase()} `]) {
80 setAppointment(db, alice, { id: walk.id, time: "08:15", place });
81 const html = await page();
82 expect(html).toContain("8:15 am · at the property");
83 expect(appointmentNote({ kind: "walkthrough", time: "08:15", place }, deal.address)).toBe("8:15 am · at the property");
84 }
85 setAppointment(db, alice, { id: walk.id, time: "08:15", place: "Lakeside Title" });
86 expect(await page()).toContain("8:15 am · Lakeside Title");
87 expect(appointmentNote({ kind: "walkthrough", time: "08:15", place: "Lakeside Title" }, deal.address)).toBe("8:15 am · Lakeside Title");
88 // the shared line, used by the timeline, calendar and drafts, still carries the full address
89 expect(appointmentLine({ kind: "walkthrough", time: "08:15", place: deal.address })).toBe(`8:15 am · ${deal.address}`);
90 });
src/week.ts +5 −4
@@ -42,7 +42,7 @@ export function closingNote(deal: WeekDeal<unknown>, d: { kind?: string }): stri
4242 /** The time and place after a row's label: the closing's, or an inspection's or walkthrough's; "" when there is none. */
4343 export function whereNote(deal: WeekDeal<unknown>, d: { kind: string; time?: string | null; place?: string | null }): string {
4444 const where = closingNote(deal, d);
45 return where === "" ? appointmentNote(d) : where;
45 return where === "" ? appointmentNote(d, deal.address) : where;
4646 }
4747
4848 export function thisWeek<D extends { due: string; done_at: string | null; waived_at: string | null }, Deal extends WeekDeal<D>>(
@@ -64,9 +64,10 @@ export function thisWeek<D extends { due: string; done_at: string | null; waived
6464 );
6565 }
6666
67 /** "10:00 am · 12 Elm St" for an inspection or walkthrough row with a time or place; "" for any other row. */
68 export function appointmentNote(d: { kind: string; time?: string | null; place?: string | null }): string {
69 return appointmentLine({ kind: d.kind, time: d.time ?? null, place: d.place ?? null });
67 /** "10:00 am · 12 Elm St" for an inspection or walkthrough row with a time or place; "" for any other row. A place equal to the deal's address (trimmed, any case) reads "at the property". */
68 export function appointmentNote(d: { kind: string; time?: string | null; place?: string | null }, address?: string): string {
69 const same = address !== undefined && d.place != null && d.place.trim() !== "" && d.place.trim().toLowerCase() === address.trim().toLowerCase();
70 return appointmentLine({ kind: d.kind, time: d.time ?? null, place: same ? "at the property" : (d.place ?? null) });
7071 }
7172
7273 /** Who owes a date: the deal's party in that role by name, if it has one, and the role either way. */

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs