AMB_BACKUP
parent
1133517117
commit
e22da6ed0b
|
|
@ -423,10 +423,10 @@ class SheetFormData(Sheet):
|
||||||
post["band"]=hit.get("band")
|
post["band"]=hit.get("band")
|
||||||
assigned_score=score_by_job.get(str(aid)) if aid else None
|
assigned_score=score_by_job.get(str(aid)) if aid else None
|
||||||
if assigned_score and assigned_score.get("overall_score") is not None:
|
if assigned_score and assigned_score.get("overall_score") is not None:
|
||||||
item["ats_score"]=assigned_score.get("overall_score")
|
item["ats_score"]=round(float(assigned_score.get("overall_score")))
|
||||||
else:
|
else:
|
||||||
nums=[s.get("overall_score") for s in scores if s.get("overall_score") is not None]
|
nums=[s.get("overall_score") for s in scores if s.get("overall_score") is not None]
|
||||||
item["ats_score"]=max(nums) if nums else None
|
item["ats_score"]=round(float(max(nums))) if nums else None
|
||||||
return items
|
return items
|
||||||
|
|
||||||
async def get_form_data(
|
async def get_form_data(
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,13 @@ function formReceivedAt(entryDate, entryTime) {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Same numeric gate as email `ats_score` / pipeline ScoreChip. */
|
||||||
|
function asAtsScore(value) {
|
||||||
|
if (value == null || value === '') return null
|
||||||
|
const n = Number(value)
|
||||||
|
return Number.isFinite(n) ? n : null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /sheet/form-data/fetch row → the same list/detail shape the email channel
|
* GET /sheet/form-data/fetch row → the same list/detail shape the email channel
|
||||||
* uses for name / avatar / position / source / time, plus form-only profile fields.
|
* uses for name / avatar / position / source / time, plus form-only profile fields.
|
||||||
|
|
@ -179,12 +186,12 @@ function mapFormRow(row) {
|
||||||
? String(row.assigned_job_post_id)
|
? String(row.assigned_job_post_id)
|
||||||
: (row.job_post_id ? String(row.job_post_id) : null)
|
: (row.job_post_id ? String(row.job_post_id) : null)
|
||||||
const assignedScore = atsResults.find((s) => String(s.job_post_id) === String(assignedId))
|
const assignedScore = atsResults.find((s) => String(s.job_post_id) === String(assignedId))
|
||||||
const numericScores = atsResults
|
const fromResults = atsResults.map((s) => asAtsScore(s.overall_score)).filter((n) => n != null)
|
||||||
.map((s) => Number(s.overall_score))
|
const fromJobs = jobPosts.map((p) => asAtsScore(p.overall_score)).filter((n) => n != null)
|
||||||
.filter((n) => Number.isFinite(n))
|
const atsScore = asAtsScore(row.ats_score)
|
||||||
const atsScore = row.ats_score
|
?? asAtsScore(assignedScore?.overall_score)
|
||||||
?? assignedScore?.overall_score
|
?? (fromResults.length ? Math.max(...fromResults) : null)
|
||||||
?? (numericScores.length ? Math.max(...numericScores) : null)
|
?? (fromJobs.length ? Math.max(...fromJobs) : null)
|
||||||
const state = row.processing_state || 'unread'
|
const state = row.processing_state || 'unread'
|
||||||
return {
|
return {
|
||||||
kind: 'form',
|
kind: 'form',
|
||||||
|
|
@ -380,7 +387,7 @@ async function fetchApplications(params) {
|
||||||
linkedinSlug: row.linkedin_slug || '',
|
linkedinSlug: row.linkedin_slug || '',
|
||||||
linkedinUrl: row.linkedin_url || '',
|
linkedinUrl: row.linkedin_url || '',
|
||||||
resumeText: row.resume_text || '',
|
resumeText: row.resume_text || '',
|
||||||
atsScore: row.ats_score,
|
atsScore: asAtsScore(row.ats_score),
|
||||||
phone: row.phone,
|
phone: row.phone,
|
||||||
experience: row.experience,
|
experience: row.experience,
|
||||||
recruiter: row.recruiter,
|
recruiter: row.recruiter,
|
||||||
|
|
@ -869,7 +876,19 @@ export default function Inbox() {
|
||||||
enabled: Boolean(selectedId),
|
enabled: Boolean(selectedId),
|
||||||
})
|
})
|
||||||
|
|
||||||
const selectedRow = inbox.find((i) => i.id === selectedId)
|
const sidebar = useMemo(() => {
|
||||||
|
if (!isForms) return list
|
||||||
|
const detail = detailQuery.data
|
||||||
|
const detailScore = asAtsScore(detail?.atsScore)
|
||||||
|
if (!detail?.id || detailScore == null) return list
|
||||||
|
return list.map((row) => (
|
||||||
|
String(row.id) === String(detail.id)
|
||||||
|
? { ...row, atsScore: asAtsScore(row.atsScore) ?? detailScore }
|
||||||
|
: row
|
||||||
|
))
|
||||||
|
}, [isForms, list, detailQuery.data])
|
||||||
|
|
||||||
|
const selectedRow = sidebar.find((i) => i.id === selectedId)
|
||||||
const selected = selectedRow || detailQuery.data
|
const selected = selectedRow || detailQuery.data
|
||||||
? { ...selectedRow, ...(detailQuery.data ?? {}) }
|
? { ...selectedRow, ...(detailQuery.data ?? {}) }
|
||||||
: null
|
: null
|
||||||
|
|
@ -1164,7 +1183,7 @@ export default function Inbox() {
|
||||||
{isForms ? 'No form responses in this sheet tab.' : 'No applications in this view.'}
|
{isForms ? 'No form responses in this sheet tab.' : 'No applications in this view.'}
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
) : (
|
) : (
|
||||||
list.map((i) => (
|
sidebar.map((i) => (
|
||||||
<div
|
<div
|
||||||
key={i.id}
|
key={i.id}
|
||||||
className={`inbox-item${i.unread ? ' unread' : ''}${selectedId === i.id ? ' active' : ''}`}
|
className={`inbox-item${i.unread ? ' unread' : ''}${selectedId === i.id ? ' active' : ''}`}
|
||||||
|
|
@ -1190,7 +1209,7 @@ export default function Inbox() {
|
||||||
<div className="ii-time">
|
<div className="ii-time">
|
||||||
{outlookListTime(i.received)}
|
{outlookListTime(i.received)}
|
||||||
</div>
|
</div>
|
||||||
{i.atsScore != null && (
|
{asAtsScore(i.atsScore) != null && (
|
||||||
<div style={{ marginTop: 6 }}><ScoreChip score={i.atsScore} /></div>
|
<div style={{ marginTop: 6 }}><ScoreChip score={i.atsScore} /></div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue