Improve company verification filtering and fix duplicate points display
- Add NonEmploymentEntityPatterns dictionary with 10 categories of non-employer entities (clubs, associations, trusts, charities, investment, property, religious, sports, educational, professional) - Expand SkipWords from ~30 to 120+ words for better core identifier extraction - Add GetSearchEntityTypes() and IsValidEmploymentEntity() helper methods - Refactor FindBestMatch() to use pattern-based filtering instead of hardcoded checks - Fix UI showing duplicate points for same company appearing multiple times (now only shows points on first occurrence, subsequent rows show 0) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -169,8 +169,10 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var verification in _report.EmploymentVerifications)
|
||||
@for (int i = 0; i < _report.EmploymentVerifications.Count; i++)
|
||||
{
|
||||
var verification = _report.EmploymentVerifications[i];
|
||||
var index = i;
|
||||
<tr>
|
||||
<td class="fw-medium">@verification.ClaimedCompany</td>
|
||||
<td>
|
||||
@@ -223,7 +225,7 @@
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@{
|
||||
var companyPoints = GetPointsForCompany(verification.ClaimedCompany, verification.MatchedCompanyName);
|
||||
var companyPoints = GetPointsForCompany(verification.ClaimedCompany, verification.MatchedCompanyName, index);
|
||||
}
|
||||
@if (companyPoints < 0)
|
||||
{
|
||||
@@ -574,6 +576,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
ComputeFirstOccurrences(); // Pre-compute which companies are first occurrences
|
||||
await AuditService.LogAsync(_userId, AuditActions.ReportViewed, "CVCheck", Id, $"Score: {_report.OverallScore}");
|
||||
}
|
||||
}
|
||||
@@ -703,10 +706,35 @@
|
||||
};
|
||||
}
|
||||
|
||||
private int GetPointsForCompany(string claimedCompany, string? matchedCompany)
|
||||
// Lookup for first occurrence of each company (pre-computed when report loads)
|
||||
private HashSet<int> _firstOccurrenceIndices = new();
|
||||
|
||||
private void ComputeFirstOccurrences()
|
||||
{
|
||||
_firstOccurrenceIndices.Clear();
|
||||
if (_report?.EmploymentVerifications is null) return;
|
||||
|
||||
var seenCompanies = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
for (int i = 0; i < _report.EmploymentVerifications.Count; i++)
|
||||
{
|
||||
var company = _report.EmploymentVerifications[i].ClaimedCompany;
|
||||
if (seenCompanies.Add(company))
|
||||
{
|
||||
_firstOccurrenceIndices.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetPointsForCompany(string claimedCompany, string? matchedCompany, int index)
|
||||
{
|
||||
if (_report?.Flags is null) return 0;
|
||||
|
||||
// Only show points for the first occurrence of each company
|
||||
if (!_firstOccurrenceIndices.Contains(index))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Sum up all flags that mention this company in their description
|
||||
var companyFlags = _report.Flags
|
||||
.Where(f => f.ScoreImpact < 0 &&
|
||||
|
||||
Reference in New Issue
Block a user