Last active
July 22, 2017 08:57
-
-
Save sungwoncho/6b02d6a27fe513395290483249486b15 to your computer and use it in GitHub Desktop.
RemoteBase - RemoteScore formula
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate RemoteScore in https://remotebase.io | |
* | |
* Currently all RemoteScores are computed in the browser using JavaScript. | |
* In the future, this logic might be brought to the server-side so that the public API can query it. | |
* | |
* Note: RemoteBase public API - https://remotebase.github.io/remotebase-api/ | |
*/ | |
const remoteScoreWeights = { | |
has_retreat: 0.2, | |
flexible_timezone: 0.1, | |
uses_realtime_communication: 0.1, | |
uses_task_tracker: 0.025, | |
uses_filesharing: 0.05, | |
has_regular_teamcall: 0.05, | |
has_handbook: 0.025 | |
}; | |
// getRemoteScore returns an integer ranging from 0 to 5 | |
function getRemoteScore(company) { | |
let rawScore = Object.keys(remoteScoreWeights).reduce((prev, key) => { | |
const weight = remoteScoreWeights[key]; | |
if (company[key]) { | |
return prev + weight; | |
} | |
return prev; | |
}, 0); | |
if (company.remoteness.val === 'fully_remote') { | |
rawScore += 0.7; | |
} else if (company.remoteness.val === 'remote_first') { | |
rawScore += 0.6; | |
} else if (company.remoteness.val === 'remote_friendly') { | |
rawScore += 0.3; | |
} | |
const finalScore = Math.floor(rawScore * 5); | |
if (finalScore > 5) { | |
return 5; | |
} | |
return finalScore; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment