Skip to content

The deal comparison

The deal comparison shows two or more deals (agreements/PSAs) side-by-side in a full-width modal, one column per deal, with every content element aligned into rows and the cells that differ highlighted. Its main use is lining up a current deal against last year's version of the same deal to see exactly what changed in the terms.

Deals are collected into a comparison basket first, then viewed together. The basket is stored in the browser's session storage: it survives navigating between pages, is private to the browser tab, and is emptied when the tab is closed. It is not saved to the server and is never visible to other users.

Building the basket and opening the comparison

  • Floating basket (bottom-right of every deal page). Shows how many deals are queued. Its buttons are Add this deal / Remove this deal, View (or Start when empty), and Clear. This is the primary entry point and is available to anyone who can view the deal.
  • ⚙ menu → Admin on a deal offers Add to / Remove from Comparison and View Comparison (n). The ⚙ menu only renders for users with edit permission on the deal, and its Admin submenu additionally requires delete permission.
  • Adding or removing shows a toast notification ("Added to comparison (2 deals)") rather than opening the modal — opening is a separate action.
  • Opening the comparison with an empty basket automatically seeds it with the deal currently on screen, so there is always something to compare against.

Inside the modal, more deals can be added two ways:

  • Search box — type-ahead over deal search (minimum 2 characters). Results are labelled YEAR-REFERENCE Name (the reference is omitted when the deal has none) and deals already in the comparison are hidden from the results.
  • "Previous deals from this supplier" — one-click chips listing expired deals (period-to date in the past) from the same supplier as the first deal in the comparison, excluding deals already queued. The prior version of the anchor deal is pulled to the front and marked with a star: it is found via the deal's previous deal link when set, otherwise the newest expired deal with the same name is assumed to be the prior version.

Each deal appears as a column headed by its reference, start year and supplier name; the deal the modal was opened from carries a Current badge. Columns can be removed individually, and Clear Comparison empties the basket and closes the modal.

How rows are aligned

Deal content is grouped into the same sections as the deal's full agreement view. Within a section, elements are matched across deals by their element ID (for example 3.1.1) — not by their position in the deal — so deals with different element sets still line up correctly. Rows are ordered numerically by ID (3.1.9 before 3.1.10), and the row set is the union across all deals: a deal that lacks an element gets an empty cell in that row. Elements without an ID cannot be cross-matched and are listed after the ID-matched rows.

How differences are detected

A cell is highlighted as a difference when any other deal's cell in the same row has a different value. The rules:

  • Values are compared after collapsing whitespace, so formatting-only variations do not count.
  • Cells whose text (ignoring markup) is "n/a" or "na" are treated as not-applicable: they are never themselves highlighted and do not cause other cells to be highlighted — except that a single real value amongst n/a cells is flagged as the odd one out.
  • An element missing from a deal entirely counts as a difference against deals that have it.
  • Differences are only counted when the comparison holds at least two deals.

Above the table, a summary bar reports "N differences found" and lists every differing row as a chip, grouped by section; clicking a chip scrolls to that row and flashes it. The Only show differences toggle hides all matching rows (and any section with no differences) to leave just the changes.

Why does the comparison change unexpectedly

  • Deals reappear after clearing — the basket is per browser tab; a comparison built in another tab has its own independent basket.
  • The basket emptied on its own — session storage is cleared when the tab or browser is closed; the basket does not survive a new session.
  • A supplier's older deal is not offered in the quick-add list — the list only shows deals whose period has ended, only reads the supplier from the first deal in the comparison, and fetches at most 50 deals.
  • The starred "previous deal" chip picks the wrong deal — when no explicit previous-deal link is set, the newest expired deal with an identical name is assumed; renaming a deal breaks that fallback.
  • Difference counts changed between viewings — the comparison always loads live deal content, so edits to any queued deal since the last viewing change the result.

What the deal comparison is not

  • Not the deals browser — that searches and lists deals; the comparison lays a chosen few out element-by-element.
  • Not the full agreement view — that shows one deal's complete content; the comparison shows several deals' content aligned against each other.
  • Not a change log — a deal's own edit history over time is shown by its Changelog, whereas the comparison contrasts separate deals as they are right now.