Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ last_enriched_3_profiles as (
where mec."memberId" = m."memberId"
and data is not null
)
and m."lastUpdatedAt" is not null
order by m."lastUpdatedAt" desc
limit 3
),
Expand All @@ -790,6 +791,7 @@ last_enriched_3_profiles_with_more_than_1000_activities as (
where mec."memberId" = m."memberId"
and data is not null
)
and m."lastUpdatedAt" is not null
order by m."lastUpdatedAt" desc
limit 3
),
Expand All @@ -803,6 +805,7 @@ last_enriched_3_profiles_with_more_than_100_activities as (
where mec."memberId" = m."memberId"
and data is not null
)
and m."lastUpdatedAt" is not null
order by m."lastUpdatedAt" desc
limit 3
),
Expand All @@ -816,6 +819,7 @@ last_enriched_3_profiles_with_more_than_10_activities as (
where mec."memberId" = m."memberId"
and data is not null
)
and m."lastUpdatedAt" is not null
order by m."lastUpdatedAt" desc
limit 3
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export default class EnrichmentServiceCrustdata extends LoggerBase implements IE
source: OrganizationSource.ENRICHMENT_CRUSTDATA,
identities,
title: workExperience.employee_title,
startDate: workExperience.start_date,
endDate: workExperience.end_date,
startDate: workExperience?.start_date ?? null,
endDate: workExperience?.end_date ?? null,
organizationDescription: workExperience.employer_linkedin_description,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,29 @@ export async function updateMemberOrg(
dateStart: toUpdate.dateStart === undefined ? toUpdate.dateStart : original.dateStart,
dateEnd: toUpdate.dateEnd === undefined ? toUpdate.dateEnd : original.dateEnd,
}

let dateEndFilter = `and "dateEnd" = $(dateEnd)`
let dateStartFilter = `and "dateStart" = $(dateStart)`

if (params.dateEnd === null) {
dateEndFilter = `and "dateEnd" is null`
delete params.dateEnd
}

if (params.dateStart === null) {
dateStartFilter = ` and "dateStart" is null`
delete params.dateStart
}

const existing = await tx.oneOrNone(
`
select 1 from "memberOrganizations"
where "memberId" = $(memberId) and
"organizationId" = $(organizationId) and
"dateStart" = $(dateStart) and
"dateEnd" = $(dateEnd) and
"deletedAt" is null
and id <> $(id)
where "memberId" = $(memberId)
and "organizationId" = $(organizationId)
${dateStartFilter}
${dateEndFilter}
and "deletedAt" is null
and id <> $(id)
`,
params,
)
Expand Down
Loading