earlsab commited on
Commit
4c4ac7c
·
1 Parent(s): 93c96d9

add proper role length

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -269,7 +269,21 @@ def create_html_output(job_result: Dict, resume_results: List[Dict]) -> str:
269
  collaboration_count += 1
270
 
271
  # Calculate experience duration
272
- if 'dates' in role and role['dates']:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  start_date = role['dates'].get('date_started', '')
274
  end_date = role['dates'].get('date_ended', '')
275
 
@@ -423,6 +437,17 @@ def create_html_output(job_result: Dict, resume_results: List[Dict]) -> str:
423
  html += f"<p><strong>Title:</strong> {' '.join(role.get('title', ['Unknown']))}</p>"
424
  if 'dates' in role and role['dates']:
425
  html += f"<p><strong>Period:</strong> {role['dates'].get('date_started', 'Unknown')} to {role['dates'].get('date_ended', 'Unknown')}</p>"
 
 
 
 
 
 
 
 
 
 
 
426
  html += f"<p><strong>Role Skills:</strong></p>"
427
  html += "<div style='margin-left: 20px;'>"
428
  for skill in role.get('skills', []):
 
269
  collaboration_count += 1
270
 
271
  # Calculate experience duration
272
+ if 'role_length' in role:
273
+ # Convert months to years (role_length is in months)
274
+ years_in_role = role['role_length'] / 12
275
+ total_experience += years_in_role
276
+
277
+ # Calculate experience per skill
278
+ for skill in role.get('skills', []):
279
+ skill_name = skill.get('name', '').lower()
280
+ if skill_name:
281
+ if skill_name in skill_experience:
282
+ skill_experience[skill_name] += years_in_role
283
+ else:
284
+ skill_experience[skill_name] = years_in_role
285
+ elif 'dates' in role and role['dates']:
286
+ # Fallback to old method if role_length is not available
287
  start_date = role['dates'].get('date_started', '')
288
  end_date = role['dates'].get('date_ended', '')
289
 
 
437
  html += f"<p><strong>Title:</strong> {' '.join(role.get('title', ['Unknown']))}</p>"
438
  if 'dates' in role and role['dates']:
439
  html += f"<p><strong>Period:</strong> {role['dates'].get('date_started', 'Unknown')} to {role['dates'].get('date_ended', 'Unknown')}</p>"
440
+ if 'role_length' in role:
441
+ years = role['role_length'] / 12
442
+ months = role['role_length'] % 12
443
+ duration_text = ""
444
+ if years >= 1:
445
+ duration_text += f"{int(years)} year{'s' if int(years) > 1 else ''}"
446
+ if months > 0:
447
+ if duration_text:
448
+ duration_text += " and "
449
+ duration_text += f"{int(months)} month{'s' if int(months) > 1 else ''}"
450
+ html += f"<p><strong>Duration:</strong> {duration_text}</p>"
451
  html += f"<p><strong>Role Skills:</strong></p>"
452
  html += "<div style='margin-left: 20px;'>"
453
  for skill in role.get('skills', []):