Skip to content

Commit f74aef1

Browse files
committed
fix: resolve pr comments from ai bots
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 34354a5 commit f74aef1

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

services/apps/cron_service/src/jobs/inferMemberOrganizationStintChanges.job.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,18 @@ const job: IJobDefinition = {
8282
*/
8383
function parseMemberActivityHash(hash: Record<string, string>) {
8484
const orgIds = Object.keys(hash)
85-
const activityDates = orgIds
86-
.flatMap((organizationId) => {
87-
try {
88-
const dates = JSON.parse(hash[organizationId])
89-
return Array.isArray(dates)
90-
? dates
91-
.filter((d): d is string => typeof d === 'string')
92-
.map((date) => ({ organizationId, date }))
93-
: []
94-
} catch {
95-
return []
96-
}
97-
})
98-
.sort((a, b) => a.date.localeCompare(b.date))
99-
85+
const activityDates = orgIds.flatMap((organizationId) => {
86+
try {
87+
const dates = JSON.parse(hash[organizationId])
88+
return Array.isArray(dates)
89+
? dates
90+
.filter((d): d is string => typeof d === 'string')
91+
.map((date) => ({ organizationId, date }))
92+
: []
93+
} catch {
94+
return []
95+
}
96+
})
10097
return { activityDates, orgIds }
10198
}
10299

services/libs/common_services/src/services/member-organization.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ export function inferMemberOrganizationStintChanges(
152152
isNew: false,
153153
}))
154154

155-
for (const { organizationId, date: targetDate } of orgDates) {
155+
const sortedDates = [...orgDates].sort((a, b) => a.date.localeCompare(b.date))
156+
157+
for (const { organizationId, date: targetDate } of sortedDates) {
156158
const orgStints = stints.filter((s) => s.organizationId === organizationId)
157159

158160
// 2. Skip if the date is already covered by an existing stint

0 commit comments

Comments
 (0)