@@ -258,7 +258,7 @@ function orgsActiveAt(datedRows: IDevStatsWorkRow[], boundaryDate: Date): IDevSt
258258 return datedRows . filter ( ( role ) => {
259259 const roleStart = startOfDay ( role . dateStart ?? '' )
260260 const roleEnd = role . dateEnd ? startOfDay ( role . dateEnd ) : null
261-
261+
262262 // org is active if the boundary date falls within its employment period
263263 return boundaryDate >= roleStart && ( ! roleEnd || boundaryDate <= roleEnd )
264264 } )
@@ -333,16 +333,24 @@ function buildTimeline(
333333
334334 // No orgs active at this boundary — close the current window and start tracking a gap
335335 if ( activeOrgsAtBoundary . length === 0 ) {
336-
337336 if ( currentOrg && currentWindowStart ) {
338- closeAffiliationWindow ( memberId , affiliations , currentOrg , currentWindowStart , dayBefore ( boundaryDate ) )
337+ closeAffiliationWindow (
338+ memberId ,
339+ affiliations ,
340+ currentOrg ,
341+ currentWindowStart ,
342+ dayBefore ( boundaryDate ) ,
343+ )
339344 currentOrg = null
340345 currentWindowStart = null
341346 }
342347
343348 if ( uncoveredPeriodStart === null ) {
344349 uncoveredPeriodStart = boundaryDate
345- log . debug ( { memberId, uncoveredPeriodStart : boundaryDate . toISOString ( ) } , 'uncovered period started' )
350+ log . debug (
351+ { memberId, uncoveredPeriodStart : boundaryDate . toISOString ( ) } ,
352+ 'uncovered period started' ,
353+ )
346354 }
347355
348356 continue
@@ -361,9 +369,15 @@ function buildTimeline(
361369 )
362370
363371 if ( fallbackOrg ) {
364- closeAffiliationWindow ( memberId , affiliations , fallbackOrg , uncoveredPeriodStart , dayBefore ( boundaryDate ) )
372+ closeAffiliationWindow (
373+ memberId ,
374+ affiliations ,
375+ fallbackOrg ,
376+ uncoveredPeriodStart ,
377+ dayBefore ( boundaryDate ) ,
378+ )
365379 }
366-
380+
367381 uncoveredPeriodStart = null
368382 }
369383
@@ -391,7 +405,13 @@ function buildTimeline(
391405 } ,
392406 'affiliation changed' ,
393407 )
394- closeAffiliationWindow ( memberId , affiliations , currentOrg , currentWindowStart ?? boundaryDate , dayBefore ( boundaryDate ) )
408+ closeAffiliationWindow (
409+ memberId ,
410+ affiliations ,
411+ currentOrg ,
412+ currentWindowStart ?? boundaryDate ,
413+ dayBefore ( boundaryDate ) ,
414+ )
395415 currentOrg = winningAffiliation
396416 currentWindowStart = boundaryDate
397417 }
@@ -401,7 +421,12 @@ function buildTimeline(
401421 if ( currentOrg && currentWindowStart ) {
402422 const endDate = currentOrg . dateEnd ? new Date ( currentOrg . dateEnd ) . toISOString ( ) : null
403423 log . debug (
404- { memberId, org : currentOrg . organizationName , start : currentWindowStart . toISOString ( ) , endDate } ,
424+ {
425+ memberId,
426+ org : currentOrg . organizationName ,
427+ start : currentWindowStart . toISOString ( ) ,
428+ endDate,
429+ } ,
405430 'closing final affiliation window' ,
406431 )
407432 affiliations . push ( {
@@ -414,7 +439,11 @@ function buildTimeline(
414439 // Close a trailing uncovered period using the fallback org (ongoing, no end date)
415440 if ( uncoveredPeriodStart !== null && fallbackOrg ) {
416441 log . debug (
417- { memberId, fallbackOrg : fallbackOrg . organizationName , uncoveredPeriodStart : uncoveredPeriodStart . toISOString ( ) } ,
442+ {
443+ memberId,
444+ fallbackOrg : fallbackOrg . organizationName ,
445+ uncoveredPeriodStart : uncoveredPeriodStart . toISOString ( ) ,
446+ } ,
418447 'closing trailing uncovered period with fallback org' ,
419448 )
420449 affiliations . push ( {
@@ -455,7 +484,11 @@ function resolveAffiliationsForMember(
455484
456485 if ( cleaned . length < rows . length ) {
457486 log . debug (
458- { memberId, dropped : rows . length - cleaned . length , keptPrimaryUndated : primaryUndated ?. organizationName } ,
487+ {
488+ memberId,
489+ dropped : rows . length - cleaned . length ,
490+ keptPrimaryUndated : primaryUndated ?. organizationName ,
491+ } ,
459492 'dropped undated orgs (primary undated exists)' ,
460493 )
461494 }
@@ -485,7 +518,11 @@ function resolveAffiliationsForMember(
485518
486519 const boundaries = collectBoundaries ( datedRows )
487520 log . debug (
488- { memberId, boundaries : boundaries . length , boundaryDates : boundaries . map ( ( b ) => b . toISOString ( ) ) } ,
521+ {
522+ memberId,
523+ boundaries : boundaries . length ,
524+ boundaryDates : boundaries . map ( ( b ) => b . toISOString ( ) ) ,
525+ } ,
489526 'collected boundaries' ,
490527 )
491528
@@ -495,7 +532,11 @@ function resolveAffiliationsForMember(
495532 {
496533 memberId,
497534 affiliations : timeline . length ,
498- result : timeline . map ( ( a ) => ( { org : a . organization , startDate : a . startDate , endDate : a . endDate } ) ) ,
535+ result : timeline . map ( ( a ) => ( {
536+ org : a . organization ,
537+ startDate : a . startDate ,
538+ endDate : a . endDate ,
539+ } ) ) ,
499540 } ,
500541 'timeline built' ,
501542 )
0 commit comments