Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removes whitelist and blacklist terminology #1393

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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 createStandizedRubric = rubric => {
iturgeon marked this conversation as resolved.
Show resolved Hide resolved
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 = standarizedMod => {
iturgeon marked this conversation as resolved.
Show resolved Hide resolved
return {
attemptCondition: getRangeString(whitelistedMod.attemptCondition),
reward: whitelistedMod.reward
attemptCondition: getRangeString(standarizedMod.attemptCondition),
iturgeon marked this conversation as resolved.
Show resolved Hide resolved
reward: standarizedMod.reward
iturgeon marked this conversation as resolved.
Show resolved Hide resolved
}
}

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 = createStandizedRubric(rubric)
iturgeon marked this conversation as resolved.
Show resolved Hide resolved
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