69 lines
2.8 KiB
Python
69 lines
2.8 KiB
Python
def _date(value):
|
|
return value.isoformat() if value else None
|
|
|
|
|
|
def _enum(value):
|
|
if value is None:
|
|
return None
|
|
return getattr(value, "value", value)
|
|
|
|
|
|
def serialize_verification_check(row, names=None) -> dict:
|
|
"""`names` is {user_id: name} from one batched Users.names_by_ids lookup in
|
|
views, so the recruiter / candidate search dropdowns can preselect on edit."""
|
|
names = names or {}
|
|
return {
|
|
"id": str(row.id) if row.id else None,
|
|
"recruiter_id": str(row.recruiter_id) if row.recruiter_id else None,
|
|
"recruiter_name": names.get(str(row.recruiter_id)) if row.recruiter_id else None,
|
|
"candidate_id": str(row.candidate_id) if row.candidate_id else None,
|
|
"candidate_name": names.get(str(row.candidate_id)) if row.candidate_id else None,
|
|
"record_overview": {
|
|
"position_applied": row.position_applied,
|
|
"department_id": str(row.department_id) if row.department_id else None,
|
|
"department": row.department,
|
|
"date_time": _date(row.date_time),
|
|
},
|
|
"employment_verification": {
|
|
"confirmed_job_title": row.confirmed_job_title,
|
|
"confirmed_from": _date(row.confirmed_from),
|
|
"confirmed_to": _date(row.confirmed_to),
|
|
"reason_for_leaving": row.reason_for_leaving,
|
|
},
|
|
"competency_evaluation": {
|
|
"technical_knowledge": {
|
|
"rating": row.technical_knowledge_rating,
|
|
"notes": row.technical_knowledge_notes,
|
|
},
|
|
"reliability": {
|
|
"rating": row.reliability_rating,
|
|
"notes": row.reliability_notes,
|
|
},
|
|
"communication": {
|
|
"rating": row.communication_rating,
|
|
"notes": row.communication_notes,
|
|
},
|
|
"problem_solving": {
|
|
"rating": row.problem_solving_rating,
|
|
"notes": row.problem_solving_notes,
|
|
},
|
|
},
|
|
"qualitative_evaluation": {
|
|
"strengths": row.strengths,
|
|
"areas_for_growth": row.areas_for_growth,
|
|
"rehire_eligibility": _enum(row.rehire_eligibility),
|
|
"rehire_comments": row.rehire_comments,
|
|
},
|
|
"referee": {
|
|
"full_name": row.referee_full_name,
|
|
"current_title": row.referee_current_title,
|
|
"company": row.referee_company,
|
|
"phone": row.referee_phone,
|
|
"email": row.referee_email,
|
|
},
|
|
"created_by": str(row.created_by) if row.created_by else None,
|
|
"created_by_name": names.get(str(row.created_by)) if row.created_by else None,
|
|
"created_at": row.created_at.isoformat() if row.created_at else None,
|
|
"updated_at": row.updated_at.isoformat() if row.updated_at else None,
|
|
}
|