Skip to content

Commit e9cca17

Browse files
committed
feat: cursor review
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 1171def commit e9cca17

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • services/libs/data-access-layer/src/affiliations

services/libs/data-access-layer/src/affiliations/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ function collectBoundaries(datedRows: IWorkRow[]): Date[] {
199199

200200
function orgsActiveAt(rows: IWorkRow[], boundaryDate: Date): IWorkRow[] {
201201
return rows.filter((role) => {
202-
if (!role.dateStart) return true // undated: active at every boundary
202+
if (!role.dateStart && !role.dateEnd) return true // truly undated: active at every boundary
203203

204-
const roleStart = startOfDay(role.dateStart)
204+
const roleStart = role.dateStart ? startOfDay(role.dateStart) : null
205205
const roleEnd = role.dateEnd ? startOfDay(role.dateEnd) : null
206206

207207
// org is active if the boundary date falls within its employment period
208-
return boundaryDate >= roleStart && (!roleEnd || boundaryDate <= roleEnd)
208+
return (!roleStart || boundaryDate >= roleStart) && (!roleEnd || boundaryDate <= roleEnd)
209209
})
210210
}
211211

0 commit comments

Comments
 (0)