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:
@@ -4,6 +4,7 @@ public sealed record CVCheckDto
|
|||||||
{
|
{
|
||||||
public required Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public required string OriginalFileName { get; init; }
|
public required string OriginalFileName { get; init; }
|
||||||
|
public string? CandidateName { get; init; }
|
||||||
public required string Status { get; init; }
|
public required string Status { get; init; }
|
||||||
public int? VeracityScore { get; init; }
|
public int? VeracityScore { get; init; }
|
||||||
public string? ProcessingStage { get; init; }
|
public string? ProcessingStage { get; init; }
|
||||||
|
|||||||
@@ -184,10 +184,38 @@ public sealed class CVCheckService : ICVCheckService
|
|||||||
|
|
||||||
private static CVCheckDto MapToDto(CVCheck cvCheck)
|
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
|
return new CVCheckDto
|
||||||
{
|
{
|
||||||
Id = cvCheck.Id,
|
Id = cvCheck.Id,
|
||||||
OriginalFileName = cvCheck.OriginalFileName,
|
OriginalFileName = cvCheck.OriginalFileName,
|
||||||
|
CandidateName = candidateName,
|
||||||
Status = cvCheck.Status.ToString(),
|
Status = cvCheck.Status.ToString(),
|
||||||
VeracityScore = cvCheck.VeracityScore,
|
VeracityScore = cvCheck.VeracityScore,
|
||||||
ProcessingStage = cvCheck.ProcessingStage,
|
ProcessingStage = cvCheck.ProcessingStage,
|
||||||
|
|||||||
@@ -210,7 +210,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<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>
|
<small class="text-muted">@Path.GetExtension(check.OriginalFileName).ToUpperInvariant()</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -659,7 +659,7 @@
|
|||||||
|
|
||||||
reportDataList.Add(new RealCV.Web.Services.PdfReportData
|
reportDataList.Add(new RealCV.Web.Services.PdfReportData
|
||||||
{
|
{
|
||||||
CandidateName = Path.GetFileNameWithoutExtension(check.OriginalFileName) ?? "Unknown",
|
CandidateName = report.CandidateName ?? Path.GetFileNameWithoutExtension(check.OriginalFileName) ?? "Unknown",
|
||||||
UploadDate = check.CreatedAt,
|
UploadDate = check.CreatedAt,
|
||||||
Score = report.OverallScore,
|
Score = report.OverallScore,
|
||||||
ScoreLabel = report.ScoreLabel,
|
ScoreLabel = report.ScoreLabel,
|
||||||
|
|||||||
Reference in New Issue
Block a user