Add GMAL standard caveats to ratecard Excel export
Ratecard Summary caveats row now combines AI match caveats with the original GMAL asset caveats (labelled "GMAL Standard Caveats:") below. Asset Detail sheet splits these into two separate columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de150f3b57
commit
4ed072105f
1 changed files with 17 additions and 3 deletions
|
|
@ -71,7 +71,17 @@ async def export_ratecard_excel(db: AsyncSession, project: Project, efficiency_l
|
|||
Match.is_selected == True,
|
||||
)
|
||||
)
|
||||
caveat_by_asset = {m.client_asset_id: m.caveat_text or "" for m in matches_result.scalars().all()}
|
||||
selected_matches = matches_result.scalars().all()
|
||||
|
||||
caveat_by_asset = {}
|
||||
for m in selected_matches:
|
||||
parts = []
|
||||
if m.caveat_text:
|
||||
parts.append(m.caveat_text)
|
||||
gmal = gmals.get(m.gmal_asset_id)
|
||||
if gmal and gmal.caveats:
|
||||
parts.append(f"GMAL Standard Caveats: {gmal.caveats}")
|
||||
caveat_by_asset[m.client_asset_id] = "\n\n".join(parts)
|
||||
|
||||
# Sheet 1: Ratecard Summary (roles x assets matrix)
|
||||
ws1 = wb.active
|
||||
|
|
@ -207,7 +217,7 @@ def _build_ratecard_sheet(ws, lines, roles, client_assets, gmals, caveats: dict
|
|||
|
||||
async def _build_asset_detail_sheet(ws, db, project, client_assets, gmals):
|
||||
"""Build the asset detail sheet showing matches and caveats."""
|
||||
headers = ["Client Asset", "Volume", "Matched GMAL", "GMAL Name", "Confidence", "Score", "Caveats"]
|
||||
headers = ["Client Asset", "Volume", "Matched GMAL", "GMAL Name", "Confidence", "Score", "Match Caveats", "GMAL Standard Caveats"]
|
||||
for col_idx, header in enumerate(headers, 1):
|
||||
cell = ws.cell(row=1, column=col_idx, value=header)
|
||||
cell.font = HEADER_FONT
|
||||
|
|
@ -239,13 +249,17 @@ async def _build_asset_detail_sheet(ws, db, project, client_assets, gmals):
|
|||
ws.cell(row=row_idx, column=5, value=match.confidence.value)
|
||||
ws.cell(row=row_idx, column=6, value=float(match.confidence_score) if match.confidence_score else 0)
|
||||
ws.cell(row=row_idx, column=7, value=match.caveat_text or "")
|
||||
ws.cell(row=row_idx, column=7).alignment = Alignment(wrap_text=True, vertical="top")
|
||||
gmal_caveats = (gmal.caveats or "") if gmal else ""
|
||||
ws.cell(row=row_idx, column=8, value=gmal_caveats)
|
||||
ws.cell(row=row_idx, column=8).alignment = Alignment(wrap_text=True, vertical="top")
|
||||
else:
|
||||
ws.cell(row=row_idx, column=3, value="No match")
|
||||
|
||||
row_idx += 1
|
||||
|
||||
# Column widths
|
||||
widths = [30, 10, 15, 40, 12, 10, 60]
|
||||
widths = [30, 10, 15, 40, 12, 10, 60, 60]
|
||||
for i, w in enumerate(widths, 1):
|
||||
ws.column_dimensions[get_column_letter(i)].width = w
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue