Skip to content

Commit

Permalink
Merge pull request #1393 from iturgeon/issue/remove-black-and-white-list
Browse files Browse the repository at this point in the history
removes whitelist and blacklist terminology
  • Loading branch information
iturgeon committed Jun 11, 2020
2 parents d077345 + 0173845 commit 5e1ef97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
@@ -1,12 +1,12 @@
const xmlEncode = require('./xml-encode')

const processAttrs = (content, blackListedAttributes) => {
const processAttrs = (content, blockedAttributes) => {
let attrs = ''
for (const attr in content) {
if (
content[attr] === null ||
typeof content[attr] === 'object' ||
blackListedAttributes.includes(attr)
blockedAttributes.includes(attr)
) {
continue
}
Expand Down
Expand Up @@ -5,7 +5,7 @@ const apiUrlRegex = /\/api\/.*/
const oboEvents = oboRequire('server/obo_events')

const getSanitizedErrorMessage = e => {
// If the error is in our blacklist only return the error name:
// If the error is in our blockList only return the error name:
if (e instanceof QueryResultError) {
return e.constructor.name
}
Expand Down
22 changes: 11 additions & 11 deletions packages/obonode/obojobo-sections-assessment/assessment-rubric.js
Expand Up @@ -35,14 +35,14 @@ const MOD_AMOUNT_LIMIT = 20
const getRubricType = rubric =>
!rubric || !rubric.type ? AssessmentRubric.TYPE_ATTEMPT : rubric.type

const createWhitelistedRubric = rubric => {
const createStandardizedRubric = rubric => {
const rubricType = getRubricType(rubric)

let whitelistedRubric
let standardizedRubric

switch (rubricType) {
case AssessmentRubric.TYPE_PASS_FAIL:
whitelistedRubric = Object.assign(
standardizedRubric = Object.assign(
{
passingAttemptScore: 100,
passedResult: 100,
Expand All @@ -55,7 +55,7 @@ const createWhitelistedRubric = rubric => {

case AssessmentRubric.TYPE_ATTEMPT:
default:
whitelistedRubric = {
standardizedRubric = {
passingAttemptScore: 0,
passedResult: AssessmentRubric.VAR_ATTEMPT_SCORE,
failedResult: 0,
Expand All @@ -64,10 +64,10 @@ const createWhitelistedRubric = rubric => {
break
}

return whitelistedRubric
return standardizedRubric
}

const createWhitelistedMod = mod => {
const createStandardizedMod = mod => {
// Ensure at least one condition exists:
if (!mod.attemptCondition) {
return null
Expand All @@ -87,10 +87,10 @@ const createWhitelistedMod = mod => {
}
}

const modToObject = whitelistedMod => {
const modToObject = standardizedMod => {
return {
attemptCondition: getRangeString(whitelistedMod.attemptCondition),
reward: whitelistedMod.reward
attemptCondition: getRangeString(standardizedMod.attemptCondition),
reward: standardizedMod.reward
}
}

Expand All @@ -111,9 +111,9 @@ class AssessmentRubric {

const mods = rubric && rubric.mods ? rubric.mods.slice(0, MOD_AMOUNT_LIMIT) : []

this.rubric = createWhitelistedRubric(rubric)
this.rubric = createStandardizedRubric(rubric)
this.type = getRubricType(rubric)
this.mods = mods.map(createWhitelistedMod).filter(mod => mod !== null)
this.mods = mods.map(createStandardizedMod).filter(mod => mod !== null)
}

toObject() {
Expand Down

0 comments on commit 5e1ef97

Please sign in to comment.