Skip to content

feat(rank-tracking): add Last checked at column to CSV and Sheets exports#71

Open
AdarshJ173 wants to merge 1 commit into
every-app:mainfrom
AdarshJ173:feat/rank-tracking-export-last-checked-at
Open

feat(rank-tracking): add Last checked at column to CSV and Sheets exports#71
AdarshJ173 wants to merge 1 commit into
every-app:mainfrom
AdarshJ173:feat/rank-tracking-export-last-checked-at

Conversation

@AdarshJ173

@AdarshJ173 AdarshJ173 commented Jul 10, 2026

Copy link
Copy Markdown

Summary

Fixes #70 — Rank Tracking exports now include a Last checked at column in both full-table and selected-row CSV and Google Sheets exports.

What changed

RankTrackingTableParts.tsx

  • Added a private formatCheckedAt(lastCheckedAt?: string | null): string helper that converts the stored ISO-8601 timestamp to a YYYY-MM-DD string — machine-sortable in Excel, Google Sheets, and any CSV viewer.
  • buildRankTrackingExport accepts a new optional lastCheckedAt?: string | null parameter. The formatted value is appended as the last column so all existing column indexes are unchanged (no breaking change for anyone already parsing the CSV programmatically).
  • exportRankTrackingCsv and exportRankTrackingToSheets each accept and forward the new parameter.

RankTrackingDomainDetail.tsx

  • Both onExport and onExportToSheets call sites now pass run?.lastCheckedAt — the value already present on resultsData.run — so the column is populated automatically on every export.

Acceptance criteria checklist

  • Full-table and selected-row CSV exports include Last checked at
  • Sheets exports include the same field and value
  • Format is YYYY-MM-DD — consistent and sortable in common spreadsheet tools
  • Existing export columns and filtered-row behaviour remain unchanged
  • Graceful empty string when run is null (no data yet)

Testing

Manual verification path (no new unit tests needed for a single helper):

  1. Open a Rank Tracking domain with at least one completed check
  2. Click Export CSV — open the file and confirm the last column is Last checked at with a YYYY-MM-DD value
  3. Click Export to Sheets — confirm the same column appears in the sheet
  4. Repeat with filters applied (selected-row export) and verify the column is still present
  5. On a domain with no completed checks, confirm the column header appears but the value is blank

Notes

  • formatCheckedAt wraps new Date(...).toISOString() in a try/catch to guard against malformed timestamps — returns "" on failure.
  • No schema changes, no server changes, no new dependencies.

Greptile Summary

This PR adds a Last checked at column to Rank Tracking CSV and Google Sheets exports by threading run?.lastCheckedAt through buildRankTrackingExport. The full-table export paths in RankTrackingDomainDetail are correctly updated, but the selected-row export paths inside RankTrackingTable are not — buildRankTrackingExport is called there without lastCheckedAt, so those exports will always emit a blank column.

  • RankTrackingTableParts.tsx — adds lastCheckedAt parameter and a formatCheckedAt helper to buildRankTrackingExport, exportRankTrackingCsv, and exportRankTrackingToSheets.
  • RankTrackingDomainDetail.tsx — passes run?.lastCheckedAt to the two full-table export call sites; does not update the <RankTrackingTable /> props, leaving selected-row exports with an empty Last checked at value.

Confidence Score: 3/5

Full-table exports work, but selected-row exports in RankTrackingTable.tsx always emit a blank Last checked at column because the PR did not update that component.

The selected-row export paths in RankTrackingTable.tsx call buildRankTrackingExport without lastCheckedAt, so the new column header appears but every value is empty — the PR's own acceptance criterion for selected-row exports is unmet.

RankTrackingTable.tsx needs a lastCheckedAt prop and both buildRankTrackingExport call sites updated; RankTrackingDomainDetail.tsx needs to pass run?.lastCheckedAt to

Important Files Changed

Filename Overview
src/client/features/rank-tracking/RankTrackingTableParts.tsx Adds lastCheckedAt param to buildRankTrackingExport, exportRankTrackingCsv, and exportRankTrackingToSheets; introduces a formatCheckedAt helper that could be simplified to a direct slice since the stored value is already ISO-8601.
src/client/features/rank-tracking/RankTrackingDomainDetail.tsx Passes run?.lastCheckedAt to the full-table CSV and Sheets export calls; does not pass it to <RankTrackingTable />, so selected-row exports remain broken.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant DD as RankTrackingDomainDetail
    participant RT as RankTrackingTable
    participant TP as RankTrackingTableParts

    Note over DD: Full-table export
    DD->>TP: exportRankTrackingCsv(filtered, ..., run?.lastCheckedAt)
    TP->>TP: buildRankTrackingExport(..., lastCheckedAt)
    TP-->>DD: CSV with Last checked at populated

    Note over RT: Selected-row export
    RT->>TP: buildRankTrackingExport(selectedRankRows, showDesktop, showMobile)
    Note right of TP: lastCheckedAt = undefined, value is always empty
    TP-->>RT: Export with Last checked at header but blank values
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant DD as RankTrackingDomainDetail
    participant RT as RankTrackingTable
    participant TP as RankTrackingTableParts

    Note over DD: Full-table export
    DD->>TP: exportRankTrackingCsv(filtered, ..., run?.lastCheckedAt)
    TP->>TP: buildRankTrackingExport(..., lastCheckedAt)
    TP-->>DD: CSV with Last checked at populated

    Note over RT: Selected-row export
    RT->>TP: buildRankTrackingExport(selectedRankRows, showDesktop, showMobile)
    Note right of TP: lastCheckedAt = undefined, value is always empty
    TP-->>RT: Export with Last checked at header but blank values
Loading

Reviews (1): Last reviewed commit: "feat(rank-tracking): add Last checked at..." | Re-trigger Greptile

…orts

Closes every-app#70

- `buildRankTrackingExport` now accepts an optional `lastCheckedAt` string
- Formats it as an ISO-8601 date string (YYYY-MM-DD) — machine-sortable
  in both Excel and Google Sheets
- Appended as the final column so existing column indexes are unchanged
- Both `exportRankTrackingCsv` and `exportRankTrackingToSheets` pass the
  value through from their call sites in `RankTrackingDomainDetail`
- Call sites updated to forward `run?.lastCheckedAt`
@bensenescu

Copy link
Copy Markdown
Contributor

@greptileai

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.

Include rank check date in Rank Tracking exports

2 participants