adjust priority of mark as not suit strategy when a job match more than one condition

This commit is contained in:
geekgeekrun
2025-06-02 21:53:12 +08:00
parent 2409699ccf
commit 48f1232f7d
@@ -684,18 +684,11 @@ async function toRecommendPage (hooks) {
// save the job detail info // save the job detail info
await hooks.jobDetailIsGetFromRecommendList?.promise(targetJobData) await hooks.jobDetailIsGetFromRecommendList?.promise(targetJobData)
//#region //#region collect not suit reasons
// null const notSuitReasonIdToStrategyMap = {}
// 刚刚活跃 // 今日活跃 // 昨日活跃 // 3日内活跃 // 本周活跃 // 2周内活跃 const notSuitConditionHandleMap = {
// 本月活跃 // 2月内活跃 // 3月内活跃 // 4月内活跃 // 5月内活跃 // 近半年活跃 // 半年前活跃 async active() {
//#endregion
const indexOfActiveText = activeDescList.indexOf(targetJobData.bossInfo.activeTimeDesc)
if (
markAsNotActiveSelectedTimeRange > 0 &&
indexOfActiveText > 0 && indexOfActiveText <= markAsNotActiveSelectedTimeRange
) {
blockBossNotActive.add(targetJobData.jobInfo.encryptUserId) blockBossNotActive.add(targetJobData.jobInfo.encryptUserId)
// click prevent recommend button
if (jobNotActiveStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) { if (jobNotActiveStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) {
try { try {
const { chosenReasonInUi } = await markJobAsNotSuitInRecommendPage(MarkAsNotSuitReason.BOSS_INACTIVE) const { chosenReasonInUi } = await markJobAsNotSuitInRecommendPage(MarkAsNotSuitReason.BOSS_INACTIVE)
@@ -728,11 +721,8 @@ async function toRecommendPage (hooks) {
} catch { } catch {
} }
} }
continue continueFind },
} async city() {
if (
(Array.isArray(expectCityList) && expectCityList.length) && !expectCityList.includes(selectedJobData.cityName)
) {
blockJobNotSuit.add(targetJobData.jobInfo.encryptId) blockJobNotSuit.add(targetJobData.jobInfo.encryptId)
if (expectCityNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) { if (expectCityNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) {
try { try {
@@ -765,11 +755,8 @@ async function toRecommendPage (hooks) {
} catch { } catch {
} }
} }
continue continueFind },
} async workExp() {
if (
(Array.isArray(expectWorkExpList) && expectWorkExpList.length) && !expectWorkExpList.includes(selectedJobData.jobExperience)
) {
blockJobNotSuit.add(targetJobData.jobInfo.encryptId) blockJobNotSuit.add(targetJobData.jobInfo.encryptId)
if (expectWorkExpNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) { if (expectWorkExpNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) {
try { try {
@@ -802,11 +789,8 @@ async function toRecommendPage (hooks) {
} catch { } catch {
} }
} }
continue continueFind },
} async jobDetail() {
if (
!testIfJobTitleOrDescriptionSuit(targetJobData.jobInfo)
) {
blockJobNotSuit.add(targetJobData.jobInfo.encryptId) blockJobNotSuit.add(targetJobData.jobInfo.encryptId)
if (jobNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) { if (jobNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS) {
try { try {
@@ -840,13 +824,63 @@ async function toRecommendPage (hooks) {
} catch { } catch {
} }
} }
}
}
//#region
// null
// 刚刚活跃 // 今日活跃 // 昨日活跃 // 3日内活跃 // 本周活跃 // 2周内活跃
// 本月活跃 // 2月内活跃 // 3月内活跃 // 4月内活跃 // 5月内活跃 // 近半年活跃 // 半年前活跃
//#endregion
const indexOfActiveText = activeDescList.indexOf(targetJobData.bossInfo.activeTimeDesc)
if (
markAsNotActiveSelectedTimeRange > 0 &&
indexOfActiveText > 0 && indexOfActiveText <= markAsNotActiveSelectedTimeRange
) {
// click prevent recommend button
notSuitReasonIdToStrategyMap.active = jobNotActiveStrategy
}
if (
(Array.isArray(expectCityList) && expectCityList.length) && !expectCityList.includes(selectedJobData.cityName)
) {
notSuitReasonIdToStrategyMap.city = expectCityNotMatchStrategy
}
if (
(Array.isArray(expectWorkExpList) && expectWorkExpList.length) && !expectWorkExpList.includes(selectedJobData.jobExperience)
) {
notSuitReasonIdToStrategyMap.workExp = expectWorkExpNotMatchStrategy
}
if (
!testIfJobTitleOrDescriptionSuit(targetJobData.jobInfo)
) {
notSuitReasonIdToStrategyMap.jobDetail = jobNotMatchStrategy
}
// #endregion
// #region execute mark logic
// 1. find the one mark on Boss
const markOnBossCondition = Object.keys(notSuitReasonIdToStrategyMap).find(k => notSuitReasonIdToStrategyMap[k] === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS)
if (markOnBossCondition) {
await notSuitConditionHandleMap[markOnBossCondition]()
continue continueFind continue continueFind
} }
// test company again - when allow list not include target company, just skip // 2. if there is no condition to mark Boss, then find the one mark on local db
const markOnLocalDbCondition = Object.keys(notSuitReasonIdToStrategyMap).find(k => notSuitReasonIdToStrategyMap[k] === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL)
if (markOnLocalDbCondition) {
await notSuitConditionHandleMap[markOnBossCondition]()
continue continueFind
}
// #endregion
if ( if (
// test company again - when allow list not include target company, just skip
enableCompanyAllowList && ![...expectCompanySet].find( enableCompanyAllowList && ![...expectCompanySet].find(
name => selectedJobData.brandName?.toLowerCase?.()?.includes(name.toLowerCase()) name => selectedJobData.brandName?.toLowerCase?.()?.includes(name.toLowerCase())
) ) ||
// check if job has been marked as not suit or not active
[
...blockJobNotSuit,
...blockBossNotActive
].includes(targetJobData.jobInfo.encryptId)
) { ) {
// just skip // just skip
continue continueFind continue continueFind