feat: Display candidate name from CV data instead of filename

- Added CandidateName field to CVCheckDto
- Extract candidate name from ReportJson or ExtractedDataJson
- Dashboard now shows actual candidate name for JSON uploads
- PDF export uses candidate name from report

This fixes the issue where JSON files showed their filename (e.g.,
"CLEAN-001") instead of the actual candidate name from the CV data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 21:23:48 +00:00
parent ecb599fba7
commit 6773162426
3 changed files with 31 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ public sealed record CVCheckDto
{
public required Guid Id { get; init; }
public required string OriginalFileName { get; init; }
public string? CandidateName { get; init; }
public required string Status { get; init; }
public int? VeracityScore { get; init; }
public string? ProcessingStage { get; init; }

View File

@@ -184,10 +184,38 @@ public sealed class CVCheckService : ICVCheckService
private static CVCheckDto MapToDto(CVCheck cvCheck)
{
string? candidateName = null;
// Try to get candidate name from ReportJson first (completed checks)
if (!string.IsNullOrEmpty(cvCheck.ReportJson))
{
try
{
var report = JsonSerializer.Deserialize<VeracityReport>(cvCheck.ReportJson, JsonDefaults.CamelCase);
candidateName = report?.CandidateName;
}
catch { /* Ignore deserialization errors */ }
}
// Fallback to ExtractedDataJson if no name in report
if (string.IsNullOrEmpty(candidateName) && !string.IsNullOrEmpty(cvCheck.ExtractedDataJson))
{
try
{
using var doc = JsonDocument.Parse(cvCheck.ExtractedDataJson);
if (doc.RootElement.TryGetProperty("fullName", out var nameElement))
{
candidateName = nameElement.GetString();
}
}
catch { /* Ignore deserialization errors */ }
}
return new CVCheckDto
{
Id = cvCheck.Id,
OriginalFileName = cvCheck.OriginalFileName,
CandidateName = candidateName,
Status = cvCheck.Status.ToString(),
VeracityScore = cvCheck.VeracityScore,
ProcessingStage = cvCheck.ProcessingStage,

View File

@@ -210,7 +210,7 @@
</svg>
</div>
<div>
<p class="mb-0 fw-semibold text-dark">@Path.GetFileNameWithoutExtension(check.OriginalFileName)</p>
<p class="mb-0 fw-semibold text-dark">@(!string.IsNullOrEmpty(check.CandidateName) ? check.CandidateName : Path.GetFileNameWithoutExtension(check.OriginalFileName))</p>
<small class="text-muted">@Path.GetExtension(check.OriginalFileName).ToUpperInvariant()</small>
</div>
</div>
@@ -659,7 +659,7 @@
reportDataList.Add(new RealCV.Web.Services.PdfReportData
{
CandidateName = Path.GetFileNameWithoutExtension(check.OriginalFileName) ?? "Unknown",
CandidateName = report.CandidateName ?? Path.GetFileNameWithoutExtension(check.OriginalFileName) ?? "Unknown",
UploadDate = check.CreatedAt,
Score = report.OverallScore,
ScoreLabel = report.ScoreLabel,